1
0
mirror of https://github.com/dockur/windows.git synced 2026-06-10 11:59:33 +08:00

fix: Provide exitcode on shutdown (#1752)

This commit is contained in:
Kroese
2026-05-31 00:30:39 +02:00
committed by GitHub
parent f088a60e2c
commit 77c164a3fa
+13 -6
View File
@@ -11,11 +11,8 @@ QEMU_LOG="$QEMU_DIR/qemu.log"
QEMU_OUT="$QEMU_DIR/qemu.out"
QEMU_END="$QEMU_DIR/qemu.end"
rm -f "$QEMU_DIR/qemu.*"
touch "$QEMU_LOG"
_trap() {
func="$1" ; shift
local func="$1" ; shift
for sig ; do
trap "$func $sig" "$sig"
done
@@ -173,15 +170,23 @@ terminal() {
_graceful_shutdown() {
local code=$?
local sig="$1"
local code=0
set +e
case "$sig" in
SIGTERM) code=143 ;;
SIGINT) code=130 ;;
SIGHUP) code=129 ;;
SIGABRT) code=134 ;;
SIGQUIT) code=131 ;;
esac
if [ -f "$QEMU_END" ]; then
info "Received $1 while already shutting down..."
return
fi
set +e
touch "$QEMU_END"
info "Received $1, sending ACPI shutdown signal..."
@@ -230,6 +235,8 @@ _graceful_shutdown() {
finish "$code" && return "$code"
}
touch "$QEMU_LOG"
SERIAL="pty"
MONITOR="telnet:localhost:$MON_PORT,server,nowait,nodelay -daemonize -D $QEMU_LOG"