欺骗应用程序,以为它的标准输入是互动的,不是管 [英] Trick an application into thinking its stdin is interactive, not a pipe

查看:118
本文介绍了欺骗应用程序,以为它的标准输入是互动的,不是管的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做的相反

<一个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆