fix: Race between signal handler and cleanup (#1350)

This commit is contained in:
Kroese
2026-08-05 21:09:01 +02:00
committed by GitHub
parent dced815c06
commit fec4f876e7
+5 -2
View File
@@ -344,7 +344,7 @@ graceful_shutdown() {
code=$(signalCode "$sig")
if [ -f "$QEMU_END" ]; then
if (( SHUTDOWN_SIGNAL != 0 )); then
# A second Ctrl-C is the explicit user request to skip the remaining
# graceful-shutdown wait and proceed to forced cleanup.
@@ -358,11 +358,14 @@ graceful_shutdown() {
return
fi
set +e
start=$SECONDS
SHUTDOWN_SIGNAL=$code
# Shutdown handlers must continue through missing processes and failed cleanup
# commands instead of being aborted by errexit.
set +e
touch "$QEMU_END"
echo && info "Received $sig signal, sending shutdown command..."
if ! readQemuPid pid; then