mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Do not return false read error when piping to tio
This commit is contained in:
parent
40c8753151
commit
a0a8dccd51
1 changed files with 7 additions and 2 deletions
|
|
@ -1153,11 +1153,16 @@ int tty_connect(void)
|
|||
{
|
||||
/* Input from stdin ready */
|
||||
ssize_t bytes_read = read(STDIN_FILENO, input_buffer, BUFSIZ);
|
||||
if (bytes_read <= 0)
|
||||
if (bytes_read < 0)
|
||||
{
|
||||
tio_error_printf_silent("Could not read from stdin");
|
||||
tio_error_printf_silent("Could not read from stdin (%s)", strerror(errno));
|
||||
goto error_read;
|
||||
}
|
||||
else if (bytes_read == 0)
|
||||
{
|
||||
// Reached EOF (when piping to stdin)
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* Process input byte by byte */
|
||||
for (int i=0; i<bytes_read; i++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue