@ai-ecoverse/slicc-kernel 1.32.0 → 1.32.1

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/node.js CHANGED
@@ -347,6 +347,10 @@ function nullFile() {
347
347
  }
348
348
  });
349
349
  }
350
+ function written(device, bytes) {
351
+ if (device === "full" && bytes.length > 0) throw new KernelError("ENOSPC");
352
+ return bytes.length;
353
+ }
350
354
  function deviceFile(device, access) {
351
355
  const read = async (max) => {
352
356
  if (device === "null") return new Uint8Array(0);
@@ -360,7 +364,7 @@ function deviceFile(device, access) {
360
364
  };
361
365
  return new OpenFile({
362
366
  ...access !== "write" ? { read } : {},
363
- ...access !== "read" ? { write: async (bytes) => bytes.length } : {},
367
+ ...access !== "read" ? { write: async (bytes) => written(device, bytes) } : {},
364
368
  seek: async () => 0,
365
369
  heldMeta: { device, ...access ? { access } : {} },
366
370
  close: () => {
@@ -3495,6 +3499,7 @@ var ChildTable = class {
3495
3499
  openSlot(slot, n, captured) {
3496
3500
  if ("fd" in slot) return this.parentFds.get(slot.fd).retain();
3497
3501
  if ("input" in slot) return bytesSource(slot.input);
3502
+ if ("device" in slot) return deviceFile(slot.device, slot.access);
3498
3503
  if ("capture" in slot) {
3499
3504
  const chunks2 = [];
3500
3505
  captured.set(n, chunks2);
@@ -6928,11 +6933,11 @@ var Pages = class {
6928
6933
  runs.push({ offset: start, bytes });
6929
6934
  i = j;
6930
6935
  }
6931
- const written = Math.max(this.stored, ...runs.map((r) => r.offset + r.bytes.length));
6936
+ const written2 = Math.max(this.stored, ...runs.map((r) => r.offset + r.bytes.length));
6932
6937
  return {
6933
6938
  ...this.shrink !== void 0 ? { shrink: this.shrink } : {},
6934
6939
  runs,
6935
- ...this.length > written ? { extend: this.length } : {}
6940
+ ...this.length > written2 ? { extend: this.length } : {}
6936
6941
  };
6937
6942
  }
6938
6943
  flushed() {