-
- Downloads
Kill the child processes spawned by a run command
When the timeout occurs it is important to ensure clean up of child processes. Killing only the direct process created by a command can leave child processes running. For example a pmbootstrap.py install will run apk add. This run command creates multiple processes as follows: (cmd line arguments snipped for readability) $ ps -e -o pid,ppid,pgid,cmd PID PPID PGID CMD 31738 23247 31738 python3 ./pmbootstrap.py -t 15 install --no-fde 31746 31738 31738 sudo env -i /bin/sh -c ... ;apk --no-progress add 31747 31746 31738 /bin/sh -c ... ;apk --no-progress add 31748 31747 31738 apk --no-progress add The root process of the run command is PID 31746. We want to kill the child processes too. Otherwise only running kill -9 31746 will leave the processes 31747 and 31748 running.
Please register or sign in to comment