@wrongstack/tools 0.299.0 → 0.300.0

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/audit.js CHANGED
@@ -666,7 +666,7 @@ var ProcessRegistryImpl = class {
666
666
  const p = this.processes.get(pid);
667
667
  if (!p) return false;
668
668
  if (p.killed) return true;
669
- if (p.protected) return false;
669
+ if (p.protected && opts.includeProtected !== true) return false;
670
670
  if (opts.preserveBackground && p.background) return false;
671
671
  const { force = false, graceMs = DEFAULT_GRACE_MS } = opts;
672
672
  const isWin2 = os.platform() === "win32";
@@ -717,9 +717,13 @@ var ProcessRegistryImpl = class {
717
717
  killAll(opts = {}) {
718
718
  const pids = Array.from(this.processes.keys());
719
719
  const killed = [];
720
+ const includeProtected = opts.includeProtected === true;
720
721
  for (const pid of pids) {
721
722
  const p = this.processes.get(pid);
722
- if (p && !p.protected && this.kill(pid, opts)) killed.push(pid);
723
+ if (!p) continue;
724
+ if (p.protected && !includeProtected) continue;
725
+ if (opts.preserveBackground && p.background) continue;
726
+ if (this.kill(pid, opts)) killed.push(pid);
723
727
  }
724
728
  return killed;
725
729
  }
package/dist/bash.js CHANGED
@@ -696,7 +696,7 @@ var ProcessRegistryImpl = class {
696
696
  const p = this.processes.get(pid);
697
697
  if (!p) return false;
698
698
  if (p.killed) return true;
699
- if (p.protected) return false;
699
+ if (p.protected && opts.includeProtected !== true) return false;
700
700
  if (opts.preserveBackground && p.background) return false;
701
701
  const { force = false, graceMs = DEFAULT_GRACE_MS } = opts;
702
702
  const isWin2 = os.platform() === "win32";
@@ -747,9 +747,13 @@ var ProcessRegistryImpl = class {
747
747
  killAll(opts = {}) {
748
748
  const pids = Array.from(this.processes.keys());
749
749
  const killed = [];
750
+ const includeProtected = opts.includeProtected === true;
750
751
  for (const pid of pids) {
751
752
  const p = this.processes.get(pid);
752
- if (p && !p.protected && this.kill(pid, opts)) killed.push(pid);
753
+ if (!p) continue;
754
+ if (p.protected && !includeProtected) continue;
755
+ if (opts.preserveBackground && p.background) continue;
756
+ if (this.kill(pid, opts)) killed.push(pid);
753
757
  }
754
758
  return killed;
755
759
  }