@ai-ecoverse/slicc-kernel 1.103.0 → 1.103.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.
@@ -941,6 +941,7 @@ function parseSyncFsStat(json2) {
941
941
  isFile: s.isFile,
942
942
  isDirectory: s.isDirectory,
943
943
  isSymbolicLink: s.isSymbolicLink,
944
+ ...s.isSocket === true ? { isSocket: true } : {},
944
945
  size: s.size,
945
946
  ...typeof s.mode === "number" ? { mode: s.mode } : {},
946
947
  ...typeof s.mtimeMs === "number" ? { mtimeMs: s.mtimeMs } : {},
@@ -1316,7 +1317,7 @@ function exactIn(node) {
1316
1317
  return node?.mount.opts.bridge.owners === true;
1317
1318
  }
1318
1319
  function modeFromStat(st, exact = false) {
1319
- const type = st.isSymbolicLink ? S_IFLNK : st.isDirectory ? S_IFDIR : S_IFREG;
1320
+ const type = st.isSymbolicLink ? S_IFLNK : st.isDirectory ? S_IFDIR : st.isSocket ? S_IFSOCK : S_IFREG;
1320
1321
  const fallback = st.isDirectory || st.isSymbolicLink ? 511 : 438;
1321
1322
  const perm = (st.mode ?? fallback) & PERM_MASK;
1322
1323
  return type | (exact ? perm : perm || fallback);
@@ -1862,6 +1863,10 @@ function createStreamOps(h) {
1862
1863
  return want;
1863
1864
  };
1864
1865
  const directory = (stream) => {
1866
+ if ((stream.node.mode & S_IFMT) === S_IFSOCK && !(stream.flags & O_PATH)) {
1867
+ if (stream.fd !== void 0) Fs.closeStream?.(stream.fd);
1868
+ throw new Fs.ErrnoError(wasiErrno("ENXIO"));
1869
+ }
1865
1870
  const bridge = bridgeOf(stream.node);
1866
1871
  if (!bridge.owners || !Fs.isDir(stream.node.mode) || stream.flags & O_PATH) return;
1867
1872
  try {
@@ -2339,7 +2344,7 @@ function readingLinks(Fs) {
2339
2344
  }
2340
2345
  };
2341
2346
  }
2342
- var S_IFDIR, S_IFREG, S_IFLNK, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
2347
+ var S_IFDIR, S_IFREG, S_IFLNK, S_IFSOCK, S_IFMT, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
2343
2348
  var init_live_vfs_fs = __esm({
2344
2349
  "src/realm/live-vfs-fs.ts"() {
2345
2350
  "use strict";
@@ -2352,6 +2357,8 @@ var init_live_vfs_fs = __esm({
2352
2357
  S_IFDIR = 16384;
2353
2358
  S_IFREG = 32768;
2354
2359
  S_IFLNK = 40960;
2360
+ S_IFSOCK = 49152;
2361
+ S_IFMT = 61440;
2355
2362
  PERM_MASK = 4095;
2356
2363
  DEFAULT_DIR_PERM = 493;
2357
2364
  UMASK = 18;
@@ -2427,7 +2434,7 @@ function mountVfsIntoEmscripten(Fs, deps) {
2427
2434
  linuxRmdir(Fs);
2428
2435
  if (deps.cred) Fs.sliccCred = deps.cred;
2429
2436
  try {
2430
- Fs.chdir(deps.cwd);
2437
+ (Fs.sliccChdirAt ?? Fs.chdir).call(Fs, deps.cwd);
2431
2438
  } catch (err) {
2432
2439
  warn(`cannot chdir to ${deps.cwd}: errno ${err.errno}`);
2433
2440
  }
@@ -2484,7 +2491,7 @@ var KERNEL_VERSION, OS_RELEASE;
2484
2491
  var init_version = __esm({
2485
2492
  "src/version.ts"() {
2486
2493
  "use strict";
2487
- KERNEL_VERSION = true ? "1.103.0" : "0.0.0-dev";
2494
+ KERNEL_VERSION = true ? "1.103.2" : "0.0.0-dev";
2488
2495
  OS_RELEASE = "6.0.0-slicc";
2489
2496
  }
2490
2497
  });
@@ -3387,6 +3394,7 @@ function kernelUname(imports, hostname, memory, glue) {
3387
3394
  function kernelChdir(Fs) {
3388
3395
  const { chdir, lookupPath, ErrnoError } = Fs;
3389
3396
  if (!chdir || !lookupPath || !ErrnoError) return;
3397
+ Fs.sliccChdirAt = chdir;
3390
3398
  Fs.chdir = (path) => {
3391
3399
  const { node } = lookupPath.call(Fs, path, { follow: true });
3392
3400
  const directory = Fs.isDir?.(node.mode) === true;
@@ -4051,13 +4059,13 @@ var init_kernel_streams = __esm({
4051
4059
  const name2 = path.slice(path.lastIndexOf("/") + 1);
4052
4060
  if (!TTY_NAME.test(name2)) return void 0;
4053
4061
  const { lookupPath, cwd } = this.Fs;
4054
- const absolute = path.startsWith("/") ? path : `${cwd?.call(this.Fs) ?? "/"}/${path}`;
4055
- const dir = absolute.slice(0, absolute.lastIndexOf("/")) || "/";
4062
+ const absolute2 = path.startsWith("/") ? path : `${cwd?.call(this.Fs) ?? "/"}/${path}`;
4063
+ const dir = absolute2.slice(0, absolute2.lastIndexOf("/")) || "/";
4056
4064
  try {
4057
4065
  const real = lookupPath?.call(this.Fs, dir, { follow: true }).path ?? dir;
4058
4066
  return `${real === "/" ? "" : real}/${name2}`;
4059
4067
  } catch {
4060
- return absolute;
4068
+ return absolute2;
4061
4069
  }
4062
4070
  }
4063
4071
  terminalExists(path) {
@@ -4497,7 +4505,7 @@ function createProcessKernel(deps) {
4497
4505
  if (!stream) return { none: true };
4498
4506
  promote?.(stream);
4499
4507
  if (stream.sliccKernelFd !== void 0) return { fd: stream.sliccKernelFd };
4500
- if (((stream.node?.mode ?? 0) & S_IFMT) === S_IFDIR2 && stream.path) return { dir: stream.path };
4508
+ if (((stream.node?.mode ?? 0) & S_IFMT2) === S_IFDIR2 && stream.path) return { dir: stream.path };
4501
4509
  const device2 = deviceOfStream(stream);
4502
4510
  if (device2) return device2;
4503
4511
  return n === 0 ? { input: drain(Fs, stream) } : { capture: true };
@@ -4549,6 +4557,7 @@ function createProcessKernel(deps) {
4549
4557
  argv,
4550
4558
  env: env ?? deps.env,
4551
4559
  cwd: cwd ?? Fs.cwd(),
4560
+ ...cwd !== null ? { chdir: true } : {},
4552
4561
  stdio,
4553
4562
  ...inherit.length > 0 ? { inherit } : {},
4554
4563
  ...exec ? { exec } : {},
@@ -4644,14 +4653,14 @@ function createProcessKernel(deps) {
4644
4653
  }
4645
4654
  };
4646
4655
  }
4647
- var S_IFMT, S_IFDIR2, POLLIN2, POLLOUT2, POLLERR2, POLLHUP2, POLLNVAL, SELECT_SLICE_MS, WUNTRACED, WCONTINUED;
4656
+ var S_IFMT2, S_IFDIR2, POLLIN2, POLLOUT2, POLLERR2, POLLHUP2, POLLNVAL, SELECT_SLICE_MS, WUNTRACED, WCONTINUED;
4648
4657
  var init_process_children = __esm({
4649
4658
  "src/process/process-children.ts"() {
4650
4659
  "use strict";
4651
4660
  init_signals();
4652
4661
  init_process_fork();
4653
4662
  init_wasi_errno();
4654
- S_IFMT = 61440;
4663
+ S_IFMT2 = 61440;
4655
4664
  S_IFDIR2 = 16384;
4656
4665
  POLLIN2 = 1;
4657
4666
  POLLOUT2 = 4;
@@ -4818,22 +4827,6 @@ function resolved(Fs, addr) {
4818
4827
  const path = addr.path.startsWith("/") ? addr.path : `${Fs.cwd()}/${addr.path}`;
4819
4828
  return { family: "unix", path: normalizePath(path) };
4820
4829
  }
4821
- function socketNode(Fs, addr) {
4822
- if (addr.family !== "unix" || !addr.path || addr.path.startsWith("\0")) return void 0;
4823
- const fs = Fs;
4824
- let stream;
4825
- try {
4826
- stream = Fs.open(addr.path, O_WRONLY3 | O_CREAT4 | O_EXCL3, 493);
4827
- } catch (e) {
4828
- if (e?.errno === wasiErrno("EEXIST")) {
4829
- throw new SyscallError("EADDRINUSE");
4830
- }
4831
- throw e;
4832
- }
4833
- if (Fs.close) Fs.close(stream);
4834
- else Fs.closeStream(stream.fd);
4835
- return { remove: () => fs.unlink?.(addr.path) };
4836
- }
4837
4830
  function createSocketKernel(deps) {
4838
4831
  const { transport, Fs, sys, streams } = deps;
4839
4832
  const call2 = (req) => {
@@ -4900,16 +4893,7 @@ function createSocketKernel(deps) {
4900
4893
  throw e;
4901
4894
  }
4902
4895
  }),
4903
- bind: (fd, given) => guard(() => {
4904
- const addr = resolved(Fs, given);
4905
- const node = socketNode(Fs, addr);
4906
- try {
4907
- return done({ op: "sock-bind", fd: kfd(fd), addr });
4908
- } catch (e) {
4909
- node?.remove();
4910
- throw e;
4911
- }
4912
- }),
4896
+ bind: (fd, given) => guard(() => done({ op: "sock-bind", fd: kfd(fd), addr: resolved(Fs, given) })),
4913
4897
  listen: (fd, backlog) => guard(() => done({ op: "sock-listen", fd: kfd(fd), backlog })),
4914
4898
  accept: (fd, nonblock, cloexec) => guard(() => {
4915
4899
  const listener = socketAt(fd);
@@ -4955,7 +4939,7 @@ function createSocketKernel(deps) {
4955
4939
  })
4956
4940
  };
4957
4941
  }
4958
- var O_RDWR2, KILLED_BY_SIGPIPE2, O_WRONLY3, O_CREAT4, O_EXCL3;
4942
+ var O_RDWR2, KILLED_BY_SIGPIPE2;
4959
4943
  var init_process_sockets = __esm({
4960
4944
  "src/process/process-sockets.ts"() {
4961
4945
  "use strict";
@@ -4965,9 +4949,6 @@ var init_process_sockets = __esm({
4965
4949
  init_wasi_errno();
4966
4950
  O_RDWR2 = 2;
4967
4951
  KILLED_BY_SIGPIPE2 = 128 + 13;
4968
- O_WRONLY3 = 1;
4969
- O_CREAT4 = 64;
4970
- O_EXCL3 = 128;
4971
4952
  }
4972
4953
  });
4973
4954
 
@@ -5956,7 +5937,7 @@ function runMain(running, init) {
5956
5937
  return status2;
5957
5938
  }
5958
5939
  }
5959
- var FS_OPS, O_RDONLY2, O_WRONLY4, O_RDWR3, O_ACCMODE5, O_DIRECTORY2, accessMode, PLACED, GLUE_TRAILER, evaluateGlue, EVAL_BLOCKED;
5940
+ var FS_OPS, O_RDONLY2, O_WRONLY3, O_RDWR3, O_ACCMODE5, O_DIRECTORY2, accessMode, PLACED, GLUE_TRAILER, evaluateGlue, EVAL_BLOCKED;
5960
5941
  var init_process_runtime = __esm({
5961
5942
  "src/process/process-runtime.ts"() {
5962
5943
  "use strict";
@@ -5980,11 +5961,11 @@ var init_process_runtime = __esm({
5980
5961
  init_kernel_streams();
5981
5962
  FS_OPS = new Set(SYNC_FS_OPS);
5982
5963
  O_RDONLY2 = 0;
5983
- O_WRONLY4 = 1;
5964
+ O_WRONLY3 = 1;
5984
5965
  O_RDWR3 = 2;
5985
5966
  O_ACCMODE5 = 3;
5986
5967
  O_DIRECTORY2 = 65536;
5987
- accessMode = (access) => access === "read" ? O_RDONLY2 : access === "write" ? O_WRONLY4 : O_RDWR3;
5968
+ accessMode = (access) => access === "read" ? O_RDONLY2 : access === "write" ? O_WRONLY3 : O_RDWR3;
5988
5969
  PLACED = /* @__PURE__ */ new Set(["stream", "file", "socket", "clipboard", "sealed"]);
5989
5970
  GLUE_TRAILER = [
5990
5971
  "if (typeof ENV !== 'undefined') Object.assign(ENV, Module.sliccEnv);",
@@ -6944,7 +6925,7 @@ function promoteRequest(fd, f, handed) {
6944
6925
  op: "fd-promote",
6945
6926
  fd,
6946
6927
  path: f.path,
6947
- flags: (f.writable ? f.readable ? O_RDWR4 : O_WRONLY5 : 0) | (f.append ? O_APPEND2 : 0),
6928
+ flags: (f.writable ? f.readable ? O_RDWR4 : O_WRONLY4 : 0) | (f.append ? O_APPEND2 : 0),
6948
6929
  position: f.offset,
6949
6930
  ...joins ? {} : { contents: f.buffer.contents() },
6950
6931
  ...orphan ? { orphan: true } : {},
@@ -6953,7 +6934,7 @@ function promoteRequest(fd, f, handed) {
6953
6934
  ...f.buffer.handle !== void 0 ? { handle: f.buffer.handle } : {}
6954
6935
  };
6955
6936
  }
6956
- var SYNTHETIC_DIRS2, O_NONBLOCK2, O_WRONLY5, O_RDWR4, O_APPEND2, SEALED_PATH2, CLIPBOARD_PATH2, WasiFds, GEN2;
6937
+ var SYNTHETIC_DIRS2, O_NONBLOCK2, O_WRONLY4, O_RDWR4, O_APPEND2, SEALED_PATH2, CLIPBOARD_PATH2, WasiFds, GEN2;
6957
6938
  var init_wasi_fds = __esm({
6958
6939
  "src/process/wasi/wasi-fds.ts"() {
6959
6940
  "use strict";
@@ -6964,7 +6945,7 @@ var init_wasi_fds = __esm({
6964
6945
  init_wasi_files();
6965
6946
  SYNTHETIC_DIRS2 = ["usr", "bin"];
6966
6947
  O_NONBLOCK2 = 2048;
6967
- O_WRONLY5 = 1;
6948
+ O_WRONLY4 = 1;
6968
6949
  O_RDWR4 = 2;
6969
6950
  O_APPEND2 = 1024;
6970
6951
  SEALED_PATH2 = "/dev/sealed";
@@ -7500,7 +7481,7 @@ var init_wasi_fds = __esm({
7500
7481
  if (oflags & OFLAGS.DIRECTORY) throw new WasiError("ENOTDIR");
7501
7482
  if (oflags & OFLAGS.CREAT && oflags & OFLAGS.EXCL) throw new WasiError("EEXIST");
7502
7483
  const want = wantOf2(oflags, rights);
7503
- const flags = want === 6 ? O_RDWR4 : want === 2 ? O_WRONLY5 : 0;
7484
+ const flags = want === 6 ? O_RDWR4 : want === 2 ? O_WRONLY4 : 0;
7504
7485
  return openDevice2.call(this.kernel.sys, flags);
7505
7486
  }
7506
7487
  open(path, oflags, rights, fdflags) {
@@ -7604,7 +7585,7 @@ var init_wasi_fds = __esm({
7604
7585
  kernelFile(path, existing, oflags, rights, fdflags) {
7605
7586
  const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
7606
7587
  const append = (fdflags & FDFLAGS.APPEND) !== 0;
7607
- const flags = (writable2 ? readable3 ? O_RDWR4 : O_WRONLY5 : 0) | (append ? O_APPEND2 : 0);
7588
+ const flags = (writable2 ? readable3 ? O_RDWR4 : O_WRONLY4 : 0) | (append ? O_APPEND2 : 0);
7608
7589
  const made = !existing && this.createNew(path, oflags);
7609
7590
  const truncate = made || (oflags & OFLAGS.TRUNC) !== 0;
7610
7591
  const fd = this.kernel.sys.openVfs(path, flags, 0, {
@@ -8087,6 +8068,10 @@ function openRequest(af, type) {
8087
8068
  ...type === DGRAM ? { type: "dgram" } : {}
8088
8069
  };
8089
8070
  }
8071
+ function absolute(cwd, addr) {
8072
+ if (addr.family !== "unix" || addr.path === "" || addr.path.startsWith("\0")) return addr;
8073
+ return addr.path.startsWith("/") ? addr : { family: "unix", path: `${cwd}/${addr.path}` };
8074
+ }
8090
8075
  function optionalAddr(view, ptr) {
8091
8076
  if (ptr === 0 || view.getUint8(ptr) === 0) return void 0;
8092
8077
  return readAddr(view, ptr);
@@ -8155,7 +8140,7 @@ function wasixSocketImports(host, preview1) {
8155
8140
  },
8156
8141
  sock_bind: (fd, addr) => {
8157
8142
  socket(fd);
8158
- call2({ op: "sock-bind", fd, addr: readAddr(mem.view(), addr) });
8143
+ call2({ op: "sock-bind", fd, addr: absolute(host.cwd, readAddr(mem.view(), addr)) });
8159
8144
  },
8160
8145
  sock_listen: (fd, backlog) => {
8161
8146
  socket(fd);
@@ -8163,7 +8148,8 @@ function wasixSocketImports(host, preview1) {
8163
8148
  },
8164
8149
  sock_connect: (fd, addr) => {
8165
8150
  const e = socket(fd);
8166
- call2({ op: "sock-connect", fd, addr: readAddr(mem.view(), addr), nonblock: e.nonblock });
8151
+ const to = absolute(host.cwd, readAddr(mem.view(), addr));
8152
+ call2({ op: "sock-connect", fd, addr: to, nonblock: e.nonblock });
8167
8153
  },
8168
8154
  sock_accept_v2: (fd, flags, outFd, outAddr) => {
8169
8155
  const e = socket(fd);
@@ -8309,6 +8295,7 @@ function filetypeOf(s) {
8309
8295
  if (!s) return FILETYPE.UNKNOWN;
8310
8296
  if (s.isSymbolicLink) return FILETYPE.SYMBOLIC_LINK;
8311
8297
  if (s.isDirectory) return FILETYPE.DIRECTORY;
8298
+ if (s.isSocket) return FILETYPE.SOCKET_STREAM;
8312
8299
  return s.isFile ? FILETYPE.REGULAR_FILE : FILETYPE.UNKNOWN;
8313
8300
  }
8314
8301
  function filestatOf(path, s) {
@@ -9376,14 +9363,14 @@ function restarted2(issue) {
9376
9363
  function resolveFrom(cwd, path) {
9377
9364
  return normalize(path.startsWith("/") ? path : `${cwd}/${path}`);
9378
9365
  }
9379
- var O_WRONLY6, O_RDWR5, O_APPEND3, OFLAG_CREAT, OFLAG_TRUNC, JOIN_NON_BLOCKING, JOIN_WAKE_STOPPED, JOIN_STOPPED, WasixProcess;
9366
+ var O_WRONLY5, O_RDWR5, O_APPEND3, OFLAG_CREAT, OFLAG_TRUNC, JOIN_NON_BLOCKING, JOIN_WAKE_STOPPED, JOIN_STOPPED, WasixProcess;
9380
9367
  var init_wasix_process = __esm({
9381
9368
  "src/process/wasi/wasix-process.ts"() {
9382
9369
  "use strict";
9383
9370
  init_physical_path();
9384
9371
  init_wasi_files();
9385
9372
  init_wasi_host();
9386
- O_WRONLY6 = 1;
9373
+ O_WRONLY5 = 1;
9387
9374
  O_RDWR5 = 2;
9388
9375
  O_APPEND3 = 1024;
9389
9376
  OFLAG_CREAT = 1;
@@ -9485,13 +9472,15 @@ var init_wasix_process = __esm({
9485
9472
  throw Object.assign(new Error("ENOENT"), { code: "ENOENT" });
9486
9473
  }
9487
9474
  const flags = (op.rightsWrite ? O_RDWR5 : 0) | (op.append ? O_APPEND3 : 0);
9488
- return this.host.o.kernel.sys.openVfs(path, op.rightsWrite ? flags || O_WRONLY6 : 0, 0, {
9475
+ return this.host.o.kernel.sys.openVfs(path, op.rightsWrite ? flags || O_WRONLY5 : 0, 0, {
9489
9476
  ...create ? { create } : {},
9490
9477
  ...op.oflags & OFLAG_TRUNC ? { truncate: true } : {}
9491
9478
  });
9492
9479
  }
9493
9480
  spawn(req, exec = false) {
9494
- const { stdio, inherit, cwd, opened: opened2 } = this.childFds(req.ops ?? []);
9481
+ const ops = req.ops ?? [];
9482
+ const { stdio, inherit, cwd, opened: opened2 } = this.childFds(ops);
9483
+ const moved = ops.some((op) => op.cmd === "chdir" || op.cmd === "fchdir");
9495
9484
  try {
9496
9485
  const spawn = {
9497
9486
  op: "proc-spawn",
@@ -9499,6 +9488,7 @@ var init_wasix_process = __esm({
9499
9488
  argv: req.argv.length > 0 ? req.argv : [req.name],
9500
9489
  env: req.env ?? this.environment(),
9501
9490
  cwd,
9491
+ ...moved ? { chdir: true } : {},
9502
9492
  stdio,
9503
9493
  inherit,
9504
9494
  ...exec ? { exec } : {},
@@ -9781,6 +9771,7 @@ function processes(host, call2, inThread) {
9781
9771
  argv: o.argv,
9782
9772
  env: o.env ?? { ...host.o.env },
9783
9773
  cwd: o.cwd ?? host.cwd,
9774
+ ...o.cwd !== void 0 ? { chdir: true } : {},
9784
9775
  stdio,
9785
9776
  ...inThread ? {} : { restart: true }
9786
9777
  };
@@ -13216,6 +13207,7 @@ function childOps(kernel, io, defaults, sync) {
13216
13207
  ...named,
13217
13208
  env: { ...o.env ?? defaults.env },
13218
13209
  cwd: o.cwd ?? defaults.cwd,
13210
+ ...o.cwd !== void 0 ? { chdir: true } : {},
13219
13211
  stdio,
13220
13212
  ...group,
13221
13213
  ...death
@@ -13395,7 +13387,7 @@ function checkOpen(abs, o, existing) {
13395
13387
  }
13396
13388
  function flagsOf(o) {
13397
13389
  const write2 = o.write || o.append || o.truncate;
13398
- const access = write2 ? o.read ? O_RDWR6 : O_WRONLY7 : 0;
13390
+ const access = write2 ? o.read ? O_RDWR6 : O_WRONLY6 : 0;
13399
13391
  return access | (o.append ? O_APPEND4 : 0);
13400
13392
  }
13401
13393
  function openRequest2(abs, o) {
@@ -13412,7 +13404,7 @@ function openRequest2(abs, o) {
13412
13404
  function index2(n, what) {
13413
13405
  if (!Number.isSafeInteger(n) || n < 0) throw new JsCallError("EINVAL", what);
13414
13406
  }
13415
- var CHUNK, MAX_IO, O_WRONLY7, O_RDWR6, O_APPEND4, BLOCK;
13407
+ var CHUNK, MAX_IO, O_WRONLY6, O_RDWR6, O_APPEND4, BLOCK;
13416
13408
  var init_js_io = __esm({
13417
13409
  "src/process/js/js-io.ts"() {
13418
13410
  "use strict";
@@ -13420,7 +13412,7 @@ var init_js_io = __esm({
13420
13412
  init_js_kernel();
13421
13413
  CHUNK = 64 * 1024;
13422
13414
  MAX_IO = 1024 * 1024;
13423
- O_WRONLY7 = 1;
13415
+ O_WRONLY6 = 1;
13424
13416
  O_RDWR6 = 2;
13425
13417
  O_APPEND4 = 1024;
13426
13418
  BLOCK = 4096;
@@ -13437,8 +13429,8 @@ function missing(path) {
13437
13429
  function nodeStat(mode, size = 0, owner) {
13438
13430
  return {
13439
13431
  isFile: false,
13440
- isDirectory: (mode & S_IFMT2) === DIR,
13441
- isSymbolicLink: (mode & S_IFMT2) === LINK,
13432
+ isDirectory: (mode & S_IFMT3) === DIR,
13433
+ isSymbolicLink: (mode & S_IFMT3) === LINK,
13442
13434
  size,
13443
13435
  mode,
13444
13436
  mtimeMs: BORN,
@@ -13777,7 +13769,7 @@ function readWholeSync(file) {
13777
13769
  file.close();
13778
13770
  }
13779
13771
  }
13780
- var DEV_READ_MAX, DEVICES2, STDIO3, SELF_FD, S_IFMT2, DIR, LINK, CHAR, BORN, CHAR_KINDS;
13772
+ var DEV_READ_MAX, DEVICES2, STDIO3, SELF_FD, S_IFMT3, DIR, LINK, CHAR, BORN, CHAR_KINDS;
13781
13773
  var init_js_dev = __esm({
13782
13774
  "src/process/js/js-dev.ts"() {
13783
13775
  "use strict";
@@ -13789,7 +13781,7 @@ var init_js_dev = __esm({
13789
13781
  DEVICES2 = ["null", "zero", "full", "random", "urandom"];
13790
13782
  STDIO3 = ["stdin", "stdout", "stderr"];
13791
13783
  SELF_FD = "/proc/self/fd";
13792
- S_IFMT2 = 61440;
13784
+ S_IFMT3 = 61440;
13793
13785
  DIR = 16384;
13794
13786
  LINK = 40960;
13795
13787
  CHAR = 8192;
@@ -14664,6 +14656,7 @@ function runSync(kernel, d, o) {
14664
14656
  ...named,
14665
14657
  env: { ...o.env ?? d.env },
14666
14658
  cwd: o.cwd === void 0 ? d.cwd : d.resolve(o.cwd),
14659
+ ...o.cwd === void 0 ? {} : { chdir: true },
14667
14660
  ...group,
14668
14661
  stdin: stdioOf(o.stdin),
14669
14662
  ...input ? { input } : {},