mirror of
https://github.com/obra/superpowers.git
synced 2026-06-29 22:19:05 +08:00
fix: foreground mode saves node PID and clears OWNER_PID on Windows/MSYS2
Verified on real Windows Git Bash: lifecycle test passed 12/12, manual start/stop released the port, and no brainstorm node processes remained.
This commit is contained in:
committed by
Drew Ritter
parent
4e3707fbbe
commit
48696e6519
@@ -107,10 +107,23 @@ if [[ -z "$OWNER_PID" || "$OWNER_PID" == "1" ]]; then
|
|||||||
OWNER_PID="$PPID"
|
OWNER_PID="$PPID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Windows/MSYS2: Node.js cannot see POSIX PIDs from the MSYS2 namespace.
|
||||||
|
# Passing a PID node cannot verify causes server to log owner-pid-invalid
|
||||||
|
# and self-terminate at the 60-second lifecycle check. Clear it so the
|
||||||
|
# watchdog is disabled and the idle timeout becomes the only shutdown trigger.
|
||||||
|
case "${OSTYPE:-}" in
|
||||||
|
msys*|cygwin*|mingw*) OWNER_PID="" ;;
|
||||||
|
esac
|
||||||
|
if [[ -n "${MSYSTEM:-}" ]]; then
|
||||||
|
OWNER_PID=""
|
||||||
|
fi
|
||||||
|
|
||||||
# Foreground mode for environments that reap detached/background processes.
|
# Foreground mode for environments that reap detached/background processes.
|
||||||
if [[ "$FOREGROUND" == "true" ]]; then
|
if [[ "$FOREGROUND" == "true" ]]; then
|
||||||
echo "$$" > "$PID_FILE"
|
env BRAINSTORM_DIR="$SESSION_DIR" BRAINSTORM_HOST="$BIND_HOST" BRAINSTORM_URL_HOST="$URL_HOST" BRAINSTORM_OWNER_PID="$OWNER_PID" node server.cjs &
|
||||||
env BRAINSTORM_DIR="$SESSION_DIR" BRAINSTORM_HOST="$BIND_HOST" BRAINSTORM_URL_HOST="$URL_HOST" BRAINSTORM_OWNER_PID="$OWNER_PID" node server.cjs
|
SERVER_PID=$!
|
||||||
|
echo "$SERVER_PID" > "$PID_FILE"
|
||||||
|
wait "$SERVER_PID"
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user