How to kill background processes upon interruption to the main tcl script?

Viewed 78

I have a tcl script (main.tcl), which kicks 2 other scripts to run in the background.

When main.tcl is interrupted using ctrl+c, the jobs launched by this script are not killed before exit. Launching subprocesses like this: exec &

What is the best way to kill all the jobs started by main.tcl, before this script is exited?

I am using tcl 8.5, not using any other packages(like tclx etc.,)

0 Answers
Related