@ai-ecoverse/slicc-kernel 1.41.2 → 1.41.3
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/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 +2 -2
package/dist/kernel-worker.js
CHANGED
|
@@ -5705,6 +5705,7 @@ var ChildTable = class {
|
|
|
5705
5705
|
});
|
|
5706
5706
|
handle.onState?.((state, sig) => {
|
|
5707
5707
|
child.stopReport = state === "stopped" ? sig : void 0;
|
|
5708
|
+
child.stoppedBy = child.stopReport;
|
|
5708
5709
|
child.continueReport = state === "continued";
|
|
5709
5710
|
this.watchers.get(handle.pid)?.(state, sig);
|
|
5710
5711
|
const waiters = this.stateChanged;
|
|
@@ -5716,7 +5717,10 @@ var ChildTable = class {
|
|
|
5716
5717
|
return handle.pid;
|
|
5717
5718
|
}
|
|
5718
5719
|
watch(pid, listener) {
|
|
5719
|
-
|
|
5720
|
+
const child = this.children.get(pid);
|
|
5721
|
+
if (!child) return;
|
|
5722
|
+
this.watchers.set(pid, listener);
|
|
5723
|
+
if (child.stoppedBy !== void 0) listener("stopped", child.stoppedBy);
|
|
5720
5724
|
}
|
|
5721
5725
|
openSlot(slot, n, captured) {
|
|
5722
5726
|
if ("fd" in slot) return this.parentFds.get(slot.fd).retain();
|
|
@@ -8985,6 +8989,7 @@ var WasmProcess = class {
|
|
|
8985
8989
|
dying = false;
|
|
8986
8990
|
umask = DEFAULT_UMASK;
|
|
8987
8991
|
execChild;
|
|
8992
|
+
killed = false;
|
|
8988
8993
|
execTermsig;
|
|
8989
8994
|
stopped = 0;
|
|
8990
8995
|
stops = 0;
|
|
@@ -9022,7 +9027,10 @@ var WasmProcess = class {
|
|
|
9022
9027
|
this.wake?.();
|
|
9023
9028
|
return "forward";
|
|
9024
9029
|
}
|
|
9025
|
-
if (sig === SIG.KILL)
|
|
9030
|
+
if (sig === SIG.KILL) {
|
|
9031
|
+
this.killed = true;
|
|
9032
|
+
return "terminate";
|
|
9033
|
+
}
|
|
9026
9034
|
if (sig === SIG.CONT) this.cont();
|
|
9027
9035
|
if (sig === SIG.STOP) return this.stop(sig);
|
|
9028
9036
|
const bit = sigbit(sig);
|
|
@@ -9040,6 +9048,19 @@ var WasmProcess = class {
|
|
|
9040
9048
|
blocked.abort();
|
|
9041
9049
|
return "deliver";
|
|
9042
9050
|
}
|
|
9051
|
+
async spawn(req) {
|
|
9052
|
+
const { file, argv, env, cwd, stdio, inherit, exec } = req;
|
|
9053
|
+
const spawned = { file, argv, env, cwd, ...exec ? { exec } : {} };
|
|
9054
|
+
const pid = await this.children.spawn(spawned, stdio, inherit);
|
|
9055
|
+
if (!exec) return pid;
|
|
9056
|
+
if (this.killed) void Promise.allSettled([this.options.kill?.(pid, SIG.KILL)]);
|
|
9057
|
+
else this.adoptExec(pid);
|
|
9058
|
+
return pid;
|
|
9059
|
+
}
|
|
9060
|
+
adoptExec(pid) {
|
|
9061
|
+
this.execChild = pid;
|
|
9062
|
+
this.children.watch(pid, (state, sig) => state === "stopped" ? this.stop(sig) : this.cont());
|
|
9063
|
+
}
|
|
9043
9064
|
onState(listener) {
|
|
9044
9065
|
this.stateListeners.push(listener);
|
|
9045
9066
|
}
|
|
@@ -9445,12 +9466,8 @@ var WasmProcess = class {
|
|
|
9445
9466
|
switch (req.op) {
|
|
9446
9467
|
case "proc-fork":
|
|
9447
9468
|
return { ok: true, kind: "json", json: await this.children.fork(req.state) };
|
|
9448
|
-
case "proc-spawn":
|
|
9449
|
-
|
|
9450
|
-
const spawned = { file, argv, env, cwd, ...exec ? { exec } : {} };
|
|
9451
|
-
const pid = await this.children.spawn(spawned, stdio, inherit);
|
|
9452
|
-
return { ok: true, kind: "json", json: pid };
|
|
9453
|
-
}
|
|
9469
|
+
case "proc-spawn":
|
|
9470
|
+
return { ok: true, kind: "json", json: await this.spawn(req) };
|
|
9454
9471
|
case "proc-wait": {
|
|
9455
9472
|
const signal = req.nohang ? this.interrupt.signal : this.blockingSignal();
|
|
9456
9473
|
const flags = {
|
|
@@ -9464,12 +9481,8 @@ var WasmProcess = class {
|
|
|
9464
9481
|
case "proc-identity":
|
|
9465
9482
|
return { ok: true, kind: "json", json: await this.options.identity?.() ?? null };
|
|
9466
9483
|
case "proc-exec": {
|
|
9467
|
-
this.
|
|
9484
|
+
this.adoptExec(req.pid);
|
|
9468
9485
|
this.options.jobs?.exec(this.pid, req.pid);
|
|
9469
|
-
this.children.watch(
|
|
9470
|
-
req.pid,
|
|
9471
|
-
(state, sig) => state === "stopped" ? this.stop(sig) : this.cont()
|
|
9472
|
-
);
|
|
9473
9486
|
await this.fds.closeAll();
|
|
9474
9487
|
try {
|
|
9475
9488
|
const waited = await this.children.wait(req.pid, false);
|