git-watchtower 2.1.10 → 2.1.11

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.
@@ -397,8 +397,6 @@ const MAX_SERVER_LOG_LINES = 500;
397
397
  const FORCE_KILL_GRACE_MS = 3000;
398
398
  /** Additional grace period added to a command's timeout before SIGKILL. */
399
399
  const SIGKILL_GRACE_AFTER_TIMEOUT_MS = 5000;
400
- /** Delay between stopping and restarting the dev server. */
401
- const SERVER_RESTART_DELAY_MS = 500;
402
400
  /** How long a transient flash message stays on screen. */
403
401
  const FLASH_MESSAGE_DURATION_MS = 3000;
404
402
  /** Debounce window for file watcher events before notifying clients. */
@@ -826,13 +824,19 @@ function stopServerProcess() {
826
824
  return Promise.race([closedPromise, hardCap]);
827
825
  }
828
826
 
829
- function restartServerProcess() {
827
+ async function restartServerProcess() {
830
828
  addLog('Restarting server...', 'update');
831
- stopServerProcess();
832
- setTimeout(() => {
833
- startServerProcess();
834
- render();
835
- }, SERVER_RESTART_DELAY_MS);
829
+ // Await actual exit before respawning. The previous fire-and-forget
830
+ // stopServerProcess() + 500 ms setTimeout was shorter than the
831
+ // FORCE_KILL_GRACE_MS (3 s) SIGKILL escalation, so a dev server with
832
+ // a slow SIGTERM handler would yield EADDRINUSE on the respawn — the
833
+ // new process tried to bind a port the old one still held.
834
+ try {
835
+ await stopServerProcess();
836
+ } catch (_) { /* stopServerProcess never rejects in practice; best-effort */ }
837
+ if (isShuttingDown) return;
838
+ startServerProcess();
839
+ render();
836
840
  }
837
841
 
838
842
  // Network and polling state
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-watchtower",
3
- "version": "2.1.10",
3
+ "version": "2.1.11",
4
4
  "description": "Terminal-based Git branch monitor with activity sparklines and optional dev server with live reload",
5
5
  "main": "bin/git-watchtower.js",
6
6
  "bin": {