From 2b0b59dfba4183aa506becf8eba98cb8ea8e2fbd Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 17 Jul 2026 19:56:05 +0200 Subject: [PATCH] feat: Preserve graceful shutdown for interactive console (#1290) --- src/power.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/power.sh b/src/power.sh index c8094f4..222e861 100644 --- a/src/power.sh +++ b/src/power.sh @@ -104,6 +104,7 @@ cleanupHelpers() { startConsole() { + local output="${1:-/dev/tty}" local cnt=0 local pid="" @@ -116,7 +117,7 @@ startConsole() { ( trap '' INT QUIT - exec nc -lU "$CONSOLE_SOCKET" /dev/tty + exec nc -lU "$CONSOLE_SOCKET" "$output" ) & pid=$! @@ -143,6 +144,13 @@ startConsole() { return 0 } +stopConsole() { + + mKill "$CONSOLE_PID" + + return 0 +} + finish() { local reason=$1 @@ -283,7 +291,8 @@ graceful_shutdown() { if (( code == 130 && SHUTDOWN_SIGNAL == code )); then SHUTDOWN_SKIP=1 - echo && info "Received SIGINT again, forcing shutdown..." return + echo && info "Received SIGINT again, forcing shutdown..." + return fi echo && info "Received $sig signal while already shutting down..."