@ai-ecoverse/slicc-kernel 1.134.0 → 1.134.2

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.
@@ -6600,7 +6600,7 @@ var KERNEL_VERSION, OS_RELEASE;
6600
6600
  var init_version = __esm({
6601
6601
  "src/version.ts"() {
6602
6602
  "use strict";
6603
- KERNEL_VERSION = true ? "1.134.0" : "0.0.0-dev";
6603
+ KERNEL_VERSION = true ? "1.134.2" : "0.0.0-dev";
6604
6604
  OS_RELEASE = "6.0.0-slicc";
6605
6605
  }
6606
6606
  });
@@ -14942,8 +14942,10 @@ function pendingReads(kernel, info, random) {
14942
14942
  };
14943
14943
  return { read: read2, closing };
14944
14944
  }
14945
- function tracked2(pending, writeAll, writeSome) {
14945
+ function tracked2(pending, writeAll, writeSome, failed5) {
14946
14946
  return (fd, data, options) => {
14947
+ const status2 = failed5?.();
14948
+ if (status2 !== void 0) return Promise.reject(new JsExit(status2));
14947
14949
  const bytes = typeof data === "string" ? encoder4.encode(data) : data;
14948
14950
  let settle;
14949
14951
  const settled2 = new Promise((resolve) => settle = resolve);
@@ -14987,7 +14989,7 @@ function createContext(o) {
14987
14989
  };
14988
14990
  const { read: read2, closing } = pendingReads(kernel, info, random);
14989
14991
  const { writes, writeAll, writeSome } = writer(kernel, info, o.pid);
14990
- const write2 = tracked2(pending, writeAll, writeSome);
14992
+ const write2 = tracked2(pending, writeAll, writeSome, o.failed);
14991
14993
  const writable2 = (fd) => new WritableStream({
14992
14994
  write: async (chunk) => {
14993
14995
  await write2(fd, chunk);
@@ -15473,9 +15475,11 @@ async function runJs(init, port3, deps, thread) {
15473
15475
  resolveExit(status3);
15474
15476
  };
15475
15477
  let failing;
15478
+ let failedWith;
15476
15479
  const fail = (err) => {
15477
15480
  if (err instanceof JsExit) return;
15478
15481
  failing ??= (thread ? Promise.resolve() : say(message(err))).then(() => exited(failed5(err)));
15482
+ failedWith ??= failed5(err);
15479
15483
  };
15480
15484
  const kernel = new JsKernel({
15481
15485
  sab: init.sab,
@@ -15499,7 +15503,8 @@ async function runJs(init, port3, deps, thread) {
15499
15503
  fs: { owners: init.owners === true, links: init.links === true },
15500
15504
  strays,
15501
15505
  thread: threadContext(port3, thread),
15502
- ...thread?.owned ? { owned: thread.owned } : {}
15506
+ ...thread?.owned ? { owned: thread.owned } : {},
15507
+ failed: () => failedWith
15503
15508
  });
15504
15509
  const say = (text) => ctx.write(2, `${init.argv0}: ${text}
15505
15510
  `).catch(() => void 0);