nterminal 1.2.24 → 1.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/nterminalctl +5 -39
package/package.json
CHANGED
package/scripts/nterminalctl
CHANGED
|
@@ -518,30 +518,6 @@ wait_for_health() {
|
|
|
518
518
|
return 1
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
-
restart_supervised_child() {
|
|
522
|
-
local monitor_pid="$1"
|
|
523
|
-
local old_pid="${2:-}"
|
|
524
|
-
|
|
525
|
-
if [[ -n "$old_pid" ]]; then
|
|
526
|
-
stop_supervised_child "$old_pid"
|
|
527
|
-
fi
|
|
528
|
-
|
|
529
|
-
local pid=""
|
|
530
|
-
local deadline=$((SECONDS + HEALTH_TIMEOUT_SECONDS))
|
|
531
|
-
while (( SECONDS <= deadline )); do
|
|
532
|
-
if ! is_running "$monitor_pid"; then
|
|
533
|
-
return 1
|
|
534
|
-
fi
|
|
535
|
-
pid="$(current_pid || true)"
|
|
536
|
-
if [[ -n "$pid" && "$pid" != "$old_pid" ]] && wait_for_health "$pid"; then
|
|
537
|
-
info "NTerminal restarted pid=$pid supervisor=$monitor_pid url=$(public_url) log=$LOG_PATH"
|
|
538
|
-
return 0
|
|
539
|
-
fi
|
|
540
|
-
sleep 0.25
|
|
541
|
-
done
|
|
542
|
-
return 1
|
|
543
|
-
}
|
|
544
|
-
|
|
545
521
|
port_owner_pid() {
|
|
546
522
|
if command -v lsof >/dev/null 2>&1; then
|
|
547
523
|
lsof -nP -iTCP:"$PORT" -sTCP:LISTEN -t 2>/dev/null | head -n 1
|
|
@@ -707,21 +683,11 @@ cmd_restart() {
|
|
|
707
683
|
start_launchd
|
|
708
684
|
else
|
|
709
685
|
prepare_start
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
local pid
|
|
716
|
-
pid="$(current_pid || true)"
|
|
717
|
-
if restart_supervised_child "$monitor_pid" "$pid"; then
|
|
718
|
-
return 0
|
|
719
|
-
fi
|
|
720
|
-
echo "NTerminal failed to restart under supervisor. Last log lines:" >&2
|
|
721
|
-
tail -n 40 "$LOG_PATH" >&2 || true
|
|
722
|
-
return 1
|
|
723
|
-
fi
|
|
724
|
-
cmd_stop >/dev/null
|
|
686
|
+
# Replace the supervisor instead of only restarting its child. The
|
|
687
|
+
# supervisor keeps its original environment, so reusing it after onboarding
|
|
688
|
+
# or npm replacement can restart the server with stale .env values or old
|
|
689
|
+
# package code.
|
|
690
|
+
cmd_stop >/dev/null || true
|
|
725
691
|
cmd_start
|
|
726
692
|
fi
|
|
727
693
|
info "NTerminal restarted"
|