Fix an issue where processes are killed unexpectedly
Summary: Fix #18 (closed)
cd8fb2d0 introduced the trap on exits or interrupts to kill the children processes. The original techniques uses SID (Session ID), but didn't account for the issue that other processes may be under the same session, which would get killed unexpectedly.
Considering that the new processes spawned by the script does not necessarily belong to the same process group (sharing the same PGID). We use a variable to store the PID of child processes and kill them at the trap.
Also add the missing untrap, which was missing due to an oversight in d0073378
Signed-off-by: Fangyi Zhou firstname.lastname@example.org