@ai-ecoverse/slicc-kernel 1.41.2 → 1.41.4
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/README.md +1 -1
- package/dist/kernel-worker.js +26 -13
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node.js +26 -13
- package/dist/node.js.map +2 -2
- package/package.json +3 -3
package/dist/node.js
CHANGED
|
@@ -4115,6 +4115,7 @@ var ChildTable = class {
|
|
|
4115
4115
|
});
|
|
4116
4116
|
handle.onState?.((state, sig) => {
|
|
4117
4117
|
child.stopReport = state === "stopped" ? sig : void 0;
|
|
4118
|
+
child.stoppedBy = child.stopReport;
|
|
4118
4119
|
child.continueReport = state === "continued";
|
|
4119
4120
|
this.watchers.get(handle.pid)?.(state, sig);
|
|
4120
4121
|
const waiters = this.stateChanged;
|
|
@@ -4126,7 +4127,10 @@ var ChildTable = class {
|
|
|
4126
4127
|
return handle.pid;
|
|
4127
4128
|
}
|
|
4128
4129
|
watch(pid, listener) {
|
|
4129
|
-
|
|
4130
|
+
const child = this.children.get(pid);
|
|
4131
|
+
if (!child) return;
|
|
4132
|
+
this.watchers.set(pid, listener);
|
|
4133
|
+
if (child.stoppedBy !== void 0) listener("stopped", child.stoppedBy);
|
|
4130
4134
|
}
|
|
4131
4135
|
openSlot(slot, n, captured) {
|
|
4132
4136
|
if ("fd" in slot) return this.parentFds.get(slot.fd).retain();
|
|
@@ -8740,6 +8744,7 @@ var WasmProcess = class {
|
|
|
8740
8744
|
dying = false;
|
|
8741
8745
|
umask = DEFAULT_UMASK;
|
|
8742
8746
|
execChild;
|
|
8747
|
+
killed = false;
|
|
8743
8748
|
execTermsig;
|
|
8744
8749
|
stopped = 0;
|
|
8745
8750
|
stops = 0;
|
|
@@ -8777,7 +8782,10 @@ var WasmProcess = class {
|
|
|
8777
8782
|
this.wake?.();
|
|
8778
8783
|
return "forward";
|
|
8779
8784
|
}
|
|
8780
|
-
if (sig === SIG.KILL)
|
|
8785
|
+
if (sig === SIG.KILL) {
|
|
8786
|
+
this.killed = true;
|
|
8787
|
+
return "terminate";
|
|
8788
|
+
}
|
|
8781
8789
|
if (sig === SIG.CONT) this.cont();
|
|
8782
8790
|
if (sig === SIG.STOP) return this.stop(sig);
|
|
8783
8791
|
const bit = sigbit(sig);
|
|
@@ -8795,6 +8803,19 @@ var WasmProcess = class {
|
|
|
8795
8803
|
blocked.abort();
|
|
8796
8804
|
return "deliver";
|
|
8797
8805
|
}
|
|
8806
|
+
async spawn(req) {
|
|
8807
|
+
const { file, argv, env, cwd, stdio, inherit, exec } = req;
|
|
8808
|
+
const spawned = { file, argv, env, cwd, ...exec ? { exec } : {} };
|
|
8809
|
+
const pid = await this.children.spawn(spawned, stdio, inherit);
|
|
8810
|
+
if (!exec) return pid;
|
|
8811
|
+
if (this.killed) void Promise.allSettled([this.options.kill?.(pid, SIG.KILL)]);
|
|
8812
|
+
else this.adoptExec(pid);
|
|
8813
|
+
return pid;
|
|
8814
|
+
}
|
|
8815
|
+
adoptExec(pid) {
|
|
8816
|
+
this.execChild = pid;
|
|
8817
|
+
this.children.watch(pid, (state, sig) => state === "stopped" ? this.stop(sig) : this.cont());
|
|
8818
|
+
}
|
|
8798
8819
|
onState(listener) {
|
|
8799
8820
|
this.stateListeners.push(listener);
|
|
8800
8821
|
}
|
|
@@ -9200,12 +9221,8 @@ var WasmProcess = class {
|
|
|
9200
9221
|
switch (req.op) {
|
|
9201
9222
|
case "proc-fork":
|
|
9202
9223
|
return { ok: true, kind: "json", json: await this.children.fork(req.state) };
|
|
9203
|
-
case "proc-spawn":
|
|
9204
|
-
|
|
9205
|
-
const spawned = { file, argv, env, cwd, ...exec ? { exec } : {} };
|
|
9206
|
-
const pid = await this.children.spawn(spawned, stdio, inherit);
|
|
9207
|
-
return { ok: true, kind: "json", json: pid };
|
|
9208
|
-
}
|
|
9224
|
+
case "proc-spawn":
|
|
9225
|
+
return { ok: true, kind: "json", json: await this.spawn(req) };
|
|
9209
9226
|
case "proc-wait": {
|
|
9210
9227
|
const signal = req.nohang ? this.interrupt.signal : this.blockingSignal();
|
|
9211
9228
|
const flags = {
|
|
@@ -9219,12 +9236,8 @@ var WasmProcess = class {
|
|
|
9219
9236
|
case "proc-identity":
|
|
9220
9237
|
return { ok: true, kind: "json", json: await this.options.identity?.() ?? null };
|
|
9221
9238
|
case "proc-exec": {
|
|
9222
|
-
this.
|
|
9239
|
+
this.adoptExec(req.pid);
|
|
9223
9240
|
this.options.jobs?.exec(this.pid, req.pid);
|
|
9224
|
-
this.children.watch(
|
|
9225
|
-
req.pid,
|
|
9226
|
-
(state, sig) => state === "stopped" ? this.stop(sig) : this.cont()
|
|
9227
|
-
);
|
|
9228
9241
|
await this.fds.closeAll();
|
|
9229
9242
|
try {
|
|
9230
9243
|
const waited = await this.children.wait(req.pid, false);
|