欺骗应用程序,以为它的标准输入是互动的,不是管 [英] Trick an application into thinking its stdin is interactive, not a pipe
问题描述
我试图做的相反
<一个href=\"http://stackoverflow.com/questions/1312922/detect-if-stdin-is-a-terminal-or-pipe-in-c-c-qt\">http://stackoverflow.com/questions/1312922/detect-if-stdin-is-a-terminal-or-pipe-in-c-c-qt
我运行,因为它检测到stdout中的管道将正在改变其输出格式的应用程序,我希望它认为这是一个互动的终端,这样我重定向时获得相同的输出。
I'm running an application that's changing its output format because it detects a pipe on stdout, and I want it to think that it's an interactive terminal so that I get the same output when redirecting.
我在想,在PHP它包裹在expect脚本或使用proc_open()将做到这一点,但事实并非如此。
I was thinking that wrapping it in an expect script or using a proc_open() in php would do it, but it doesn't.
任何想法了吗?
推荐答案
啊哈!
的剧本
命令执行我们想要的...
The script
command does what we want...
script --return -c "[executable string]" /dev/null
做的伎俩!
这篇关于欺骗应用程序,以为它的标准输入是互动的,不是管的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!