justanhduc / task-spooler

A scheduler for GPU/CPU tasks
https://justanhduc.github.io/2021/02/03/Task-Spooler.html
GNU General Public License v2.0
273 stars 24 forks source link

Using `-n` `-f` flags: pass through SIGINT (and other signals?) #36

Open Jasha10 opened 1 year ago

Jasha10 commented 1 year ago

Hi,

I want to use ts -n -f my_app to run apps in the foreground. The use case is:

For example, I might run ts -n -f python my_app.py, which runs for a long time and might sometimes want to interact with the app (e.g. if a python debugger breakpoint gets hit).

There's a problem with the -nf flags: if I press Ctrl-C to send a SIGINT signal, it causes ts to malfunction. For example:

$ ts -nf python -q
>>> 123
123
>>>
KeyboardInterrupt
>>> $  # Sending input to the python process no longer works as expected

After sending SIGINT (pressing Ctrl-C), I it seems that standard input to the python process has been messed up.

Do you have any tips for how to work around this issue? Would it be easy to modify ts so that SIGINT (and maybe other signals) get passed through to the process that's running in the foreground?

justanhduc commented 1 year ago

Hey @Jasha10. Happy New Year! In fact, all signals except for SIGPIPE should be propagated. However I was able to reproduce the bug. I will need to figure it out further to see where it goes wrong.