From b4f5b419e17de9cc56014597e2b51ab52436e87d Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 14 Jul 2025 15:47:12 -0500 Subject: [PATCH] newvm: Stop waiting for VM events if install fails If `virt-install` fails before the VM starts for the first time; the `virsh event` process running in the background will never terminate and therefore the main process will `wait` forever. We can avoid this by killing the background process if `virt-install` fails. --- newvm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newvm.sh b/newvm.sh index e2ebb3a..680a233 100755 --- a/newvm.sh +++ b/newvm.sh @@ -205,5 +205,5 @@ virsh metadata ${name} --live --config ${METADATA_XMLNS} dch \ "${groups_xml}" ) & -virt-install "$@" +virt-install "$@" || kill $! wait