Quit from non-interactive mode using ctrl-c

When piping to tio it will automatically enter "non-interactive" mode
which means it will not react to any input key sequences but simple read
the input stream and write it to the tty device.

This also means that ctrl-t q can not be used to quit and so tio would
hang forever when used in non-interactive mode.

This change allows to send the standard termination signal by pressing
ctrl-c on tio in non-interactive mode to make it quit.
This commit is contained in:
Martin Lund 2022-07-20 17:59:13 +02:00
parent eadcc7e384
commit 5f46136b28
3 changed files with 77 additions and 45 deletions

View file

@ -96,6 +96,10 @@ int main(int argc, char *argv[])
if (interactive_mode)
{
tio_printf("Press ctrl-%c q to quit", option.prefix_key);
} else
{
tio_printf("Non-interactive mode enabled");
tio_printf("Press ctrl-c to quit");
}
/* Open socket */
@ -105,7 +109,7 @@ int main(int argc, char *argv[])
}
/* Connect to tty device */
if ((option.no_autoconnect) || (!interactive_mode))
if (option.no_autoconnect)
{
status = tty_connect();
}