Skip to content

Commit a2607de

Browse files
committed
fix: prevent fallback PID from killing external server in managed mode
When REMOTE_MANAGED is 'managed' but REMOTE_PID is empty (e.g. PID file deleted or corrupted), the previous code fell back to DEFAULT_RUNTIME_PID via ${REMOTE_PID:-$DEFAULT_RUNTIME_PID}. This could kill an externally started server, causing wait_ready to fail and triggering an unnecessary full relaunch cycle. Fix: use REMOTE_PID directly without fallback so we only kill the process we actually launched. If REMOTE_PID is empty, the -n guard skips the kill.
1 parent c4be90c commit a2607de

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/ssh/src/tunnel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ if [ -n "$DEFAULT_REMOTE_PORT" ]; then
546546
REMOTE_PORT="$DEFAULT_REMOTE_PORT"
547547
if wait_ready "@@T3_REUSE_READY_TIMEOUT_MS@@"; then
548548
if [ "$REMOTE_MANAGED" = "managed" ]; then
549-
PID_TO_STOP="\${REMOTE_PID:-$DEFAULT_RUNTIME_PID}"
549+
PID_TO_STOP="$REMOTE_PID"
550550
if [ -n "$PID_TO_STOP" ] && kill -0 "$PID_TO_STOP" 2>/dev/null; then
551551
kill "$PID_TO_STOP" 2>/dev/null || true
552552
wait_for_pid_exit "$PID_TO_STOP"

0 commit comments

Comments
 (0)