mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add bidirectional redirection to shell command execution function (Ctrl-t R and --exec option)
The "shell command execution feature" previously only supported the ability to transfer a command's stdout and stderr to a device. To support bidirectional commands, a feature will be added to connect input from a device to the command's stdin. Since some communication commands (sz, rz) require stderr to be kept local, a feature will also be added to not transfer stderr to a device if the command string begins with a '?'. On Linux, you can terminate a running command by pressing Ctrl-t R again while the command is running (this uses the command /usr/bin/pkill internally).
This commit is contained in:
parent
321494b4e6
commit
445a21b807
4 changed files with 131 additions and 22 deletions
11
src/tty.c
11
src/tty.c
|
|
@ -175,7 +175,7 @@ char key_hit = 0xff;
|
|||
const char* device_name = NULL;
|
||||
GList *device_list = NULL;
|
||||
static struct termios tio, tio_raw, tio_old, stdout_new, stdout_old, stdin_new, stdin_old;
|
||||
static unsigned long rx_total = 0, tx_total = 0;
|
||||
unsigned long rx_total = 0, tx_total = 0;
|
||||
static bool connected = false;
|
||||
static bool standard_baudrate = true;
|
||||
static void (*printchar)(char c);
|
||||
|
|
@ -557,6 +557,15 @@ void *tty_stdin_input_thread(void *arg)
|
|||
tio_printf("Flushed data I/O buffers");
|
||||
tcflush(device_fd, TCIOFLUSH);
|
||||
break;
|
||||
#if defined(__linux__)
|
||||
case KEY_SHIFT_R:
|
||||
if (state == STATE_EXEC_SHELL_COMMAND)
|
||||
{
|
||||
tio_printf("Terminated shell command");
|
||||
terminate_shell_command();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue