![¿Qué significa un error "la salida no es un tty"?](https://rvso.com/image/1476433/%C2%BFQu%C3%A9%20significa%20un%20error%20%22la%20salida%20no%20es%20un%20tty%22%3F.png)
Intenté escribir la salida del comando php -i
en un archivo usando php -i > info
y recibí el siguiente error:
output is not a tty
¿Qué significa?
Lo estoy usando git bash
en Windows.
Respuesta1
Encontré un tema similar como este. Una solución que funcionó para mí:
Escribir
php.exe -i > info
en lugar de
php -i > info
Así que simplemente agregue la .exe
extensión a sus comandos y funcionará.
Encontré esta solución aquí:https://stackoverflow.com/a/44727575/2377961
Respuesta2
Si está utilizando winpty bajo el capó, debe pasar el -Xallow-non-tty
argumento para solucionar este problema:
$ winpty python -c 'print("hello")' | grep h
stdout is not a tty
$ winpty -Xallow-non-tty python -c 'print("hello")' | grep h
hello
Sin embargo, si la salida está alterada, -Xplain
también será necesario el argumento:
$ 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..
Respuesta3
Lo que funcionó para mí, según los comentarios de Peh en stackoverflow.com/questions/33622087
Si usa C:\Program Files\Git\bin\bash.exe en lugar de C:\Program Files\Git\git-bash.exe, entonces el comando funciona bien
Respuesta4
Está redirigiendo su salida desde su terminal (tty) a un archivo. Por lo tanto, su salida ya no es un tty.
El mensaje tiene mucho sentido. Sin embargo, esto no debería ser un error.
No puedo reproducir este comportamiento en un sistema Linux.