@ai-ecoverse/slicc-kernel 1.78.0 → 1.78.1

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/node.js CHANGED
@@ -17161,10 +17161,7 @@ var Launcher = class {
17161
17161
  const may = (target) => !sender || maySignal(sender, this.credOf(target)) || sig === SIG.CONT && session !== void 0 && this.jobs.sidOf(target) === session || from !== void 0 && this.imageOf(from) === this.imageOf(target) || from !== void 0 && this.granted.get(this.jobs.shown(target)) === from;
17162
17162
  if (pid === -1) {
17163
17163
  const sender2 = from === void 0 ? void 0 : this.imageOf(from);
17164
- return this.killAll(
17165
- sig,
17166
- (member) => this.imageOf(member) !== sender2 && may(this.imageOf(member))
17167
- );
17164
+ return this.killAll(sig, (member) => this.imageOf(member) !== sender2, may);
17168
17165
  }
17169
17166
  if (pid < 0) return this.jobs.killGroup(-pid, sig, (member) => may(this.imageOf(member)));
17170
17167
  const handle = this.processes.get(pid);
@@ -17173,14 +17170,17 @@ var Launcher = class {
17173
17170
  if (sig !== 0) handle.signal(sig);
17174
17171
  return true;
17175
17172
  }
17176
- killAll(sig, may) {
17177
- let any = false;
17178
- for (const [pid, handle] of [...this.processes]) {
17179
- if (pid === 1 || !may(pid)) continue;
17180
- any = true;
17181
- if (sig !== 0) handle.signal(sig);
17173
+ killAll(sig, other, may) {
17174
+ const candidates = [...this.processes].filter(([pid]) => pid !== 1 && other(pid));
17175
+ const targets = candidates.filter(([pid]) => may(this.imageOf(pid)));
17176
+ if (targets.length === 0 && candidates.length > 0) throw fsError("EPERM", "kill -1");
17177
+ const pids = new Set(targets.map(([pid]) => pid));
17178
+ const parents = new Map(this.jobs.list().map((m) => [m.pid, m.execParent]));
17179
+ for (const [pid, handle] of targets) {
17180
+ const parent = parents.get(pid);
17181
+ if (sig !== 0 && (parent === void 0 || !pids.has(parent))) handle.signal(sig);
17182
17182
  }
17183
- return any;
17183
+ return targets.length > 0;
17184
17184
  }
17185
17185
  async driver(type, spec) {
17186
17186
  if (type === "fsa") return this.fsaDriver(spec);