@wrongstack/tools 0.104.0 → 0.107.2

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/dist/pack.js CHANGED
@@ -516,7 +516,7 @@ var ProcessRegistryImpl = class {
516
516
  this.breaker = new CircuitBreaker(breakerConfig);
517
517
  }
518
518
  register(info) {
519
- this.processes.set(info.pid, { ...info, killed: false });
519
+ this.processes.set(info.pid, { ...info, killed: false, protected: info.protected ?? false });
520
520
  }
521
521
  /** Unregister a process by PID. Called on 'close' / 'exit' events. */
522
522
  unregister(pid) {
@@ -602,6 +602,7 @@ var ProcessRegistryImpl = class {
602
602
  const p = this.processes.get(pid);
603
603
  if (!p) return false;
604
604
  if (p.killed) return true;
605
+ if (p.protected) return false;
605
606
  const { force = false, graceMs = DEFAULT_GRACE_MS } = opts;
606
607
  const isWin = os.platform() === "win32";
607
608
  if (isWin) {
@@ -652,7 +653,8 @@ var ProcessRegistryImpl = class {
652
653
  const pids = Array.from(this.processes.keys());
653
654
  const killed = [];
654
655
  for (const pid of pids) {
655
- if (this.kill(pid, opts)) killed.push(pid);
656
+ const p = this.processes.get(pid);
657
+ if (p && !p.protected && this.kill(pid, opts)) killed.push(pid);
656
658
  }
657
659
  return killed;
658
660
  }