rliebz / tusk

The modern task runner
https://rliebz.github.io/tusk/
MIT License
237 stars 21 forks source link

terminating a subprocess kills tusk without running Finally block #62

Open cuotos opened 4 years ago

cuotos commented 4 years ago

I've got a task that runs a go binary until killed by the user, that binary is listen to SIGINT and SIGTERM in order to perform from cleanup operations.

So I understand correctly, if I start the app with Tusk, and kill it with ctrl+c, I kill Tusk, and "interrupt" is sent to my binary which does its cleanup. But Tusk gets killed and will not run its Finally code.

Is there any way I can pass the ctrl+c to the running process and not kill tusk instantly?

rliebz commented 4 years ago

I don't believe this is currently possible.

That said, allowing finally clauses to run after a SIGINT is probably better in general. I think it makes the most sense to make that the default behavior, and maybe a second SIGINT kills tusk.

cuotos commented 4 years ago

That would be nice. If the initial SIGINT kills the sub process. In my case the "finally" would then run and do the cleanup. For now I'll move the "finally" logic into my app.