TEST-13-NSPAWN: trivially kill all processes in the container on termination
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 24 Oct 2024 15:42:28 +0000 (00:42 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 31 Oct 2024 01:59:14 +0000 (10:59 +0900)
Follow-up for 841988f80d2440501a3baddba712cdb955225ab7.

No functional change, as $PID is 0 when the trap is inserted.

test/units/TEST-13-NSPAWN.machined.sh

index d014dfe1ba0af83e25780fc1acde4fb526f65eae..b259a5bc16c425cd09daa290e8e3823ab8abb75f 100755 (executable)
@@ -39,10 +39,10 @@ cat >/var/lib/machines/long-running/sbin/init <<\EOF
 
 PID=0
 
-trap "touch /terminate; kill $PID" RTMIN+3
-trap "touch /poweroff" RTMIN+4
-trap "touch /reboot" INT
-trap "touch /trap" TRAP
+trap 'touch /terminate; kill 0' RTMIN+3
+trap 'touch /poweroff' RTMIN+4
+trap 'touch /reboot' INT
+trap 'touch /trap' TRAP
 trap 'kill $PID' EXIT
 
 # We need to wait for the sleep process asynchronously in order to allow