mirror of
https://github.com/dockur/windows.git
synced 2026-08-05 21:47:16 +01:00
fix: Race between signal handler and cleanup (#2062)
This commit is contained in:
+3
-3
@@ -483,7 +483,7 @@ gracefulShutdown() {
|
|||||||
|
|
||||||
code=$(signalCode "$sig")
|
code=$(signalCode "$sig")
|
||||||
|
|
||||||
if [ -f "$QEMU_END" ]; then
|
if (( SHUTDOWN_SIGNAL != 0 )); then
|
||||||
|
|
||||||
# A second Ctrl-C during an active shutdown skips the remaining grace period
|
# A second Ctrl-C during an active shutdown skips the remaining grace period
|
||||||
# and lets the shutdown loop force QEMU down immediately.
|
# and lets the shutdown loop force QEMU down immediately.
|
||||||
@@ -497,12 +497,12 @@ gracefulShutdown() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SHUTDOWN_SIGNAL=$code
|
||||||
|
|
||||||
# Signal handlers must complete their own error handling and cleanup without
|
# Signal handlers must complete their own error handling and cleanup without
|
||||||
# errexit terminating the shell partway through the shutdown sequence.
|
# errexit terminating the shell partway through the shutdown sequence.
|
||||||
set +e
|
set +e
|
||||||
SHUTDOWN_SIGNAL=$code
|
|
||||||
|
|
||||||
touch "$QEMU_END"
|
|
||||||
echo && info "Received $sig signal, sending ACPI shutdown signal..."
|
echo && info "Received $sig signal, sending ACPI shutdown signal..."
|
||||||
|
|
||||||
# Interactive startup may receive a signal before the PID file appears, so
|
# Interactive startup may receive a signal before the PID file appears, so
|
||||||
|
|||||||
Reference in New Issue
Block a user