Max*_*kyi 46 windows php git-bash
我尝试php -i使用将命令的输出写入文件php -i > info并收到以下错误:
output is not a tty
这是什么意思?
我git bash在 Windows 上使用。
小智 41
我发现了一个类似的话题。一种对我有用的解决方案:
写
php.exe -i > info
Run Code Online (Sandbox Code Playgroud)
代替
php -i > info
Run Code Online (Sandbox Code Playgroud)
因此,只需将.exe扩展名附加到您的命令中即可。
在这里找到了这个解决方案:https : //stackoverflow.com/a/44727575/2377961
Chi*_*nke 24
如果您碰巧在幕后使用 winpty,则必须传递-Xallow-non-tty参数来解决此问题:
$ winpty python -c 'print("hello")' | grep h
stdout is not a tty
$ winpty -Xallow-non-tty python -c 'print("hello")' | grep h
hello
Run Code Online (Sandbox Code Playgroud)
但是,如果输出被破坏,-Xplain则还需要该参数:
$ winpty -Xallow-non-tty python -c 'print("hello")' | xxd
00000000: 1b5b 306d 1b5b 304b 6865 6c6c 6f1b 5b30 .[0m.[0Khello.[0
00000010: 4b1b 5b3f 3235 6c0d 0a1b 5b30 4b1b 5b3f K.[?25l...[0K.[?
00000020: 3235 68 25h
$ winpty -Xallow-non-tty -Xplain python -c 'print("hello")' | xxd
00000000: 6865 6c6c 6f0d 0a hello..
Run Code Online (Sandbox Code Playgroud)
小智 23
什么对我有用,基于 Peh 对 stackoverflow.com/questions/33622087 的评论
如果您使用 C:\Program Files\Git\bin\bash.exe 而不是 C:\Program Files\Git\git-bash.exe 那么该命令可以正常工作
| 归档时间: |
|
| 查看次数: |
32052 次 |
| 最近记录: |