@ai-ecoverse/slicc-kernel 1.8.3 → 1.8.5

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.
@@ -1681,6 +1681,12 @@ function wrapCloexecSyscalls(imports, glue, deps) {
1681
1681
  }
1682
1682
  }
1683
1683
  }
1684
+ function errnoOf(err) {
1685
+ const { errno: errno2, code: code2 } = err ?? {};
1686
+ if (typeof errno2 === "number") return errno2;
1687
+ if (typeof code2 === "string") return wasiErrno(code2);
1688
+ throw err;
1689
+ }
1684
1690
  function persistsItself(stream) {
1685
1691
  const type = stream.node.mount?.type;
1686
1692
  return typeof type?.syncfs === "function";
@@ -1697,8 +1703,7 @@ function syncFsync(imports, fs) {
1697
1703
  const result = stream.stream_ops.fsync?.(stream);
1698
1704
  return typeof result === "number" ? result : 0;
1699
1705
  } catch (err) {
1700
- const { errno: errno2, code: code2 } = err;
1701
- return typeof errno2 === "number" ? errno2 : wasiErrno(String(code2));
1706
+ return errnoOf(err);
1702
1707
  }
1703
1708
  };
1704
1709
  }
@@ -1739,7 +1744,7 @@ function positioned(original, write, deps) {
1739
1744
  if (moved < len) break;
1740
1745
  }
1741
1746
  } catch (err) {
1742
- return wasiErrno(String(err.code));
1747
+ return errnoOf(err);
1743
1748
  }
1744
1749
  view.setUint32(Number(rest[rest.length - 1]), done, true);
1745
1750
  return 0;