@ai-ecoverse/slicc-kernel 1.42.1 → 1.42.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/process-worker.js
CHANGED
|
@@ -5480,6 +5480,7 @@ var init_wasi_host = __esm({
|
|
|
5480
5480
|
startCwd;
|
|
5481
5481
|
interruptWakes = false;
|
|
5482
5482
|
onRaise;
|
|
5483
|
+
muted;
|
|
5483
5484
|
listening;
|
|
5484
5485
|
o;
|
|
5485
5486
|
constructor(o) {
|
|
@@ -5828,6 +5829,7 @@ var init_wasi_host = __esm({
|
|
|
5828
5829
|
return this.o.kernel.call({ op: "fd-vfs-stat", fd });
|
|
5829
5830
|
}
|
|
5830
5831
|
write(fd, data) {
|
|
5832
|
+
if (this.muted?.(fd, data)) return data.length;
|
|
5831
5833
|
const e = this.fds.get(fd);
|
|
5832
5834
|
if (e.type === "kernel") {
|
|
5833
5835
|
try {
|
|
@@ -6223,18 +6225,22 @@ var init_wasi_module = __esm({
|
|
|
6223
6225
|
});
|
|
6224
6226
|
|
|
6225
6227
|
// src/process/wasi/wasi-signals.ts
|
|
6226
|
-
var DELIVERED_MASK, WasiSignals;
|
|
6228
|
+
var DELIVERED_MASK, LIBC_DEFAULT_EXIT, WASIX_LIBC_DEFAULT_LINE, WasiSignals;
|
|
6227
6229
|
var init_wasi_signals = __esm({
|
|
6228
6230
|
"src/process/wasi/wasi-signals.ts"() {
|
|
6229
6231
|
"use strict";
|
|
6230
6232
|
init_signals();
|
|
6233
|
+
init_wasi_host();
|
|
6231
6234
|
DELIVERED_MASK = Object.values(SIG).filter((sig) => sig !== SIG.KILL && sig !== SIG.STOP).reduce((m, sig) => m | sigbit(sig), 0);
|
|
6235
|
+
LIBC_DEFAULT_EXIT = 127;
|
|
6236
|
+
WASIX_LIBC_DEFAULT_LINE = /^Program recieved (?:stop|termination|fatal) signal: [^\n]+\n$/;
|
|
6232
6237
|
WasiSignals = class {
|
|
6233
6238
|
exports;
|
|
6234
6239
|
callback;
|
|
6235
6240
|
uncaught = 0;
|
|
6236
6241
|
delivering;
|
|
6237
6242
|
defaulted = false;
|
|
6243
|
+
libcDefault = false;
|
|
6238
6244
|
fallBack;
|
|
6239
6245
|
onKilled;
|
|
6240
6246
|
constructor(fallBack, onKilled) {
|
|
@@ -6257,19 +6263,28 @@ var init_wasi_signals = __esm({
|
|
|
6257
6263
|
raise(sig) {
|
|
6258
6264
|
const handler = this.handler();
|
|
6259
6265
|
if (!handler) return;
|
|
6260
|
-
const outer = { sig: this.delivering, defaulted: this.defaulted };
|
|
6266
|
+
const outer = { sig: this.delivering, defaulted: this.defaulted, libc: this.libcDefault };
|
|
6261
6267
|
this.delivering = sig;
|
|
6262
6268
|
this.defaulted = false;
|
|
6269
|
+
this.libcDefault = false;
|
|
6263
6270
|
try {
|
|
6264
6271
|
handler(sig);
|
|
6265
6272
|
} catch (e) {
|
|
6266
|
-
|
|
6273
|
+
const libcExit = e instanceof WasiExit && e.code === LIBC_DEFAULT_EXIT && this.libcDefault;
|
|
6274
|
+
if (!(libcExit && !this.defaulted) && !(e instanceof WebAssembly.RuntimeError)) throw e;
|
|
6267
6275
|
if (!this.defaulted) this.defaultAction(sig);
|
|
6268
6276
|
} finally {
|
|
6269
6277
|
this.delivering = outer.sig;
|
|
6270
6278
|
this.defaulted = outer.defaulted;
|
|
6279
|
+
this.libcDefault = outer.libc;
|
|
6271
6280
|
}
|
|
6272
6281
|
}
|
|
6282
|
+
muted(fd, data) {
|
|
6283
|
+
if (fd !== 2 || this.delivering === void 0) return false;
|
|
6284
|
+
if (!WASIX_LIBC_DEFAULT_LINE.test(new TextDecoder().decode(data))) return false;
|
|
6285
|
+
this.libcDefault = true;
|
|
6286
|
+
return true;
|
|
6287
|
+
}
|
|
6273
6288
|
raised(sig) {
|
|
6274
6289
|
if (sig !== SIG.ABRT || this.delivering === void 0) return false;
|
|
6275
6290
|
if (!this.defaulted) this.defaultAction(this.delivering);
|
|
@@ -8119,6 +8134,7 @@ async function runWasiProcess(init, port2) {
|
|
|
8119
8134
|
publishMemory(init.sab, sizeOf(main)());
|
|
8120
8135
|
signals.bind(instance.exports);
|
|
8121
8136
|
host.onRaise = (sig) => signals.raised(sig);
|
|
8137
|
+
host.muted = (fd, data) => signals.muted(fd, data);
|
|
8122
8138
|
const exports = instance.exports;
|
|
8123
8139
|
driver.bind(instance.exports);
|
|
8124
8140
|
try {
|