git-watchtower 2.1.2 → 2.1.3

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.
@@ -708,27 +708,38 @@ function startServerProcess() {
708
708
  };
709
709
 
710
710
  try {
711
- serverProcess = spawn(cmd, args, spawnOptions);
711
+ const proc = spawn(cmd, args, spawnOptions);
712
+ serverProcess = proc;
712
713
  store.setState({ serverRunning: true });
713
714
 
714
- serverProcess.stdout.on('data', (data) => {
715
+ // Capture `proc` in each listener so a late event from an old process
716
+ // (e.g. proc1's SIGTERM-induced 'close' arriving after restart already
717
+ // spawned proc2) cannot clobber proc2's globals. Without this guard,
718
+ // proc1's close handler resolves the module-level `serverProcess` at
719
+ // execution time — which is now proc2 — and nulls it out, leaving the
720
+ // TUI thinking no server is running while proc2 is alive on its port.
721
+ proc.stdout.on('data', (data) => {
722
+ if (serverProcess !== proc) return;
715
723
  const lines = data.toString().split('\n').filter(Boolean);
716
724
  lines.forEach(line => addServerLog(line));
717
725
  });
718
726
 
719
- serverProcess.stderr.on('data', (data) => {
727
+ proc.stderr.on('data', (data) => {
728
+ if (serverProcess !== proc) return;
720
729
  const lines = data.toString().split('\n').filter(Boolean);
721
730
  lines.forEach(line => addServerLog(line, true));
722
731
  });
723
732
 
724
- serverProcess.on('error', (err) => {
733
+ proc.on('error', (err) => {
734
+ if (serverProcess !== proc) return;
725
735
  store.setState({ serverRunning: false, serverCrashed: true });
726
736
  addServerLog(`Error: ${err.message}`, true);
727
737
  addLog(`Server error: ${err.message}`, 'error');
728
738
  render();
729
739
  });
730
740
 
731
- serverProcess.on('close', (code) => {
741
+ proc.on('close', (code) => {
742
+ if (serverProcess !== proc) return;
732
743
  store.setState({ serverRunning: false });
733
744
  if (code !== 0 && code !== null) {
734
745
  store.setState({ serverCrashed: true });
@@ -742,7 +753,7 @@ function startServerProcess() {
742
753
  render();
743
754
  });
744
755
 
745
- addLog(`Server started (pid: ${serverProcess.pid})`, 'success');
756
+ addLog(`Server started (pid: ${proc.pid})`, 'success');
746
757
  } catch (err) {
747
758
  store.setState({ serverCrashed: true });
748
759
  addServerLog(`Failed to start: ${err.message}`, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-watchtower",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
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": {
@@ -67,8 +67,7 @@
67
67
  "main"
68
68
  ],
69
69
  "plugins": [
70
- "@semantic-release/commit-analyzer",
71
- "@semantic-release/release-notes-generator",
70
+ "./scripts/release-filter-cli.js",
72
71
  [
73
72
  "@semantic-release/changelog",
74
73
  {