I am running the following script to start a capture on a remote server and download the file afterwards. Currently I have to pause it with Ctrl+C and manu
To send a Ctrl+C, do:
send \x03
To handle an incoming Ctrl+C, do:
trap {your handler script here} SIGINT
You might want to make the handler script (which can be a multi-line thing) send the signal on to the inner process…
trap {
send \x03
send_user "You pressed Ctrl+C\n"
} SIGINT
But take care! When the user presses Ctrl+C in a text-mode program (in most GUIs, it's a copy action) they are usually expecting it to go away pretty soon, so you should take care to ensure that you don't spend too long after the signal arrives cleaning everything up.