php – Composer安装错误 – 输出不是tty,输入不是tty

前端之家收集整理的这篇文章主要介绍了php – Composer安装错误 – 输出不是tty,输入不是tty前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试通过PHP安装composer,如他们的wesite所述.
PHP -r "readfile('https://getcomposer.org/installer');" | PHP

但它显示以下错误

$PHP -r "readfile('https://getcomposer.org/installer');" | PHP
output is not a tty
input is not a tty

我在Windows 7中并使用git bash来执行此命令.在Windows命令提示符下,它工作正常.只有从git bash 2.6.2-64bit运行此命令时才会出现此问题.

顺便说一下,我已经为windows安装了composer,这很好用.但我无法以这种方式下载composer.phar.我该如何解决这个问题?

它可以是PATH或编码问题:

> issue 25提到:

it seems that git ls-remote origin,run from a freshly-built and installed MinGW Git fails to be able to output anything,and git ls-remote origin | cat (a trick learned from working with old MSys’/MinGW’s quirks) only says: output is not a tty (the exit code is 127,suggesting that some executable was not found,but it is very difficult to say which one because not even debug print statements to stderr are shown; It seems that in case of a crash or of a die(),stderr is not flushed)

> issue 519甚至建议unalias winpty

unalias $(alias | grep winpty | cut -d"=" -f1 | cut -d" " -f2)

但:

No,we cannot simply abandon winpty. PHP can be run interactively,i.e. it requires a proper Win32 Console. Running PHP without winpty in MinTTY would not provide that Console instance,leaving you with a seemingly unresponsive terminal.

See 07002,07003 and 07004 to understand what havoc you would wreak by simply removing those aliases.

所以现在,bash控制台与通过管道执行PHP不兼容(因为第二个| PHP可能无法从winpty中受益,这在程序需要Win32控制台进行交互式使用时似乎需要).

Peh指出in the comments

If you use C:`Program Files\Git\bin\bash.exeinstead ofC:\Program Files\Git\git-bash.exe`,then the command works fine.
I’m using it in combination with 07007 without any problems

这可能是因为bash.exe不使用winpty,与git-bash.exe相反.

原文链接:https://www.f2er.com/php/137626.html

猜你在找的PHP相关文章