@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.
@@ -4002,6 +4002,7 @@ function childOps(kernel, io, defaults) {
4002
4002
  const spawn = async (o) => {
4003
4003
  const [file] = o.argv;
4004
4004
  if (file === void 0) throw new JsCallError("EINVAL", "spawn");
4005
+ const group = groupOf(o, "spawn");
4005
4006
  const mine = [];
4006
4007
  const theirs = [];
4007
4008
  try {
@@ -4012,7 +4013,8 @@ function childOps(kernel, io, defaults) {
4012
4013
  argv: [...o.argv],
4013
4014
  env: { ...o.env ?? defaults.env },
4014
4015
  cwd: o.cwd ?? defaults.cwd,
4015
- stdio
4016
+ stdio,
4017
+ ...group
4016
4018
  });
4017
4019
  return childOf(pid, mine);
4018
4020
  } catch (err) {
@@ -4024,6 +4026,15 @@ function childOps(kernel, io, defaults) {
4024
4026
  };
4025
4027
  return { spawn, wait: wait2, kill };
4026
4028
  }
4029
+ function groupOf(o, call2) {
4030
+ const { pgid, session } = o;
4031
+ const valid = pgid === void 0 || Number.isInteger(pgid) && pgid >= 0;
4032
+ if (!valid || session !== void 0 && typeof session !== "boolean") {
4033
+ throw new JsCallError("EINVAL", call2);
4034
+ }
4035
+ if (session && pgid !== void 0) throw new JsCallError("EINVAL", call2);
4036
+ return session ? { session: true } : pgid !== void 0 ? { pgid } : {};
4037
+ }
4027
4038
  async function closeAll(io, fds) {
4028
4039
  for (const fd of fds) if (fd !== void 0) await io.close(fd).catch(() => void 0);
4029
4040
  }
@@ -5080,6 +5091,7 @@ function decodeRun(bytes, stdout, stderr) {
5080
5091
  function runSync(kernel, d, o) {
5081
5092
  const [file] = o.argv;
5082
5093
  if (file === void 0) throw new JsCallError("EINVAL", "run");
5094
+ const group = groupOf(o, "run");
5083
5095
  const stdout = stdioOf(o.stdout);
5084
5096
  const stderr = stderrOf(o.stderr);
5085
5097
  const input = typeof o.input === "string" ? encoder2.encode(o.input) : o.input;
@@ -5091,6 +5103,7 @@ function runSync(kernel, d, o) {
5091
5103
  argv: [...o.argv],
5092
5104
  env: { ...o.env ?? d.env },
5093
5105
  cwd: o.cwd === void 0 ? d.cwd : d.resolve(o.cwd),
5106
+ ...group,
5094
5107
  stdin: stdioOf(o.stdin),
5095
5108
  ...input ? { input } : {},
5096
5109
  stdout,
@@ -5106,6 +5119,7 @@ var encoder2, STDIO4;
5106
5119
  var init_js_run = __esm({
5107
5120
  "src/process/js/js-run.ts"() {
5108
5121
  "use strict";
5122
+ init_js_children();
5109
5123
  init_js_kernel();
5110
5124
  encoder2 = new TextEncoder();
5111
5125
  STDIO4 = /* @__PURE__ */ new Set(["pipe", "ignore", "inherit"]);