From 078d6e126e5bcc84d7b3c411074e09008b24c950 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 19 Jul 2023 13:17:40 -0400 Subject: [PATCH] vm.zsh: Various Updates * Improve the exit trap to make sure child processes are stopped * wait $(jobs -pr) is the same thing as wait with no options Signed-off-by: Anna Schumaker --- vm.zsh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/vm.zsh b/vm.zsh index 947bc6c..b7d5314 100755 --- a/vm.zsh +++ b/vm.zsh @@ -33,12 +33,8 @@ function vm_reboot() { vm_boot $1 } -TRAPEXIT() { - if [[ ! -z "$(jobs -pr)" ]]; then - for job in ($(jobs -pr)); do - kill -9 $job - done - fi +TRAPINT() { + kill -9 0 } for vm in "${@:2}"; do @@ -59,4 +55,4 @@ for vm in "${@:2}"; do esac done -wait $(jobs -pr) +wait