@ai-ecoverse/slicc-kernel 1.73.3 → 1.74.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.
@@ -11138,6 +11138,7 @@ function childOps(kernel, io, defaults) {
11138
11138
  const spawn = async (o) => {
11139
11139
  const [file] = o.argv;
11140
11140
  if (file === void 0) throw new JsCallError("EINVAL", "spawn");
11141
+ const group = groupOf(o, "spawn");
11141
11142
  const mine = [];
11142
11143
  const theirs = [];
11143
11144
  try {
@@ -11148,7 +11149,8 @@ function childOps(kernel, io, defaults) {
11148
11149
  argv: [...o.argv],
11149
11150
  env: { ...o.env ?? defaults.env },
11150
11151
  cwd: o.cwd ?? defaults.cwd,
11151
- stdio
11152
+ stdio,
11153
+ ...group
11152
11154
  });
11153
11155
  return childOf(pid, mine);
11154
11156
  } catch (err) {
@@ -11160,6 +11162,15 @@ function childOps(kernel, io, defaults) {
11160
11162
  };
11161
11163
  return { spawn, wait: wait2, kill };
11162
11164
  }
11165
+ function groupOf(o, call2) {
11166
+ const { pgid, session } = o;
11167
+ const valid = pgid === void 0 || Number.isInteger(pgid) && pgid >= 0;
11168
+ if (!valid || session !== void 0 && typeof session !== "boolean") {
11169
+ throw new JsCallError("EINVAL", call2);
11170
+ }
11171
+ if (session && pgid !== void 0) throw new JsCallError("EINVAL", call2);
11172
+ return session ? { session: true } : pgid !== void 0 ? { pgid } : {};
11173
+ }
11163
11174
  async function closeAll(io, fds) {
11164
11175
  for (const fd of fds) if (fd !== void 0) await io.close(fd).catch(() => void 0);
11165
11176
  }
@@ -12216,6 +12227,7 @@ function decodeRun(bytes, stdout, stderr) {
12216
12227
  function runSync(kernel, d, o) {
12217
12228
  const [file] = o.argv;
12218
12229
  if (file === void 0) throw new JsCallError("EINVAL", "run");
12230
+ const group = groupOf(o, "run");
12219
12231
  const stdout = stdioOf(o.stdout);
12220
12232
  const stderr = stderrOf(o.stderr);
12221
12233
  const input = typeof o.input === "string" ? encoder2.encode(o.input) : o.input;
@@ -12227,6 +12239,7 @@ function runSync(kernel, d, o) {
12227
12239
  argv: [...o.argv],
12228
12240
  env: { ...o.env ?? d.env },
12229
12241
  cwd: o.cwd === void 0 ? d.cwd : d.resolve(o.cwd),
12242
+ ...group,
12230
12243
  stdin: stdioOf(o.stdin),
12231
12244
  ...input ? { input } : {},
12232
12245
  stdout,
@@ -12242,6 +12255,7 @@ var encoder2, STDIO4;
12242
12255
  var init_js_run = __esm({
12243
12256
  "src/process/js/js-run.ts"() {
12244
12257
  "use strict";
12258
+ init_js_children();
12245
12259
  init_js_kernel();
12246
12260
  encoder2 = new TextEncoder();
12247
12261
  STDIO4 = /* @__PURE__ */ new Set(["pipe", "ignore", "inherit"]);