@ai-ecoverse/slicc-kernel 1.60.1 → 1.61.0

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
@@ -2161,6 +2161,7 @@ function processes(l, self) {
2161
2161
  const viewer = credOf(self);
2162
2162
  return l.list(viewer).map(({ tid: _, cred = viewer, umask: _umask, ...entry }) => ({
2163
2163
  ...entry,
2164
+ rss: entry.memory,
2164
2165
  uid: cred.euid,
2165
2166
  gid: cred.egid
2166
2167
  }));
@@ -6234,6 +6235,19 @@ function mkdirOptions(entry, mode = 511) {
6234
6235
  const parents = 511 & ~(entry.umask?.() ?? 18) | 192;
6235
6236
  return { recursive: true, owner: { ...owner, parents } };
6236
6237
  }
6238
+ async function mkdirExclusive(entry, path, mode) {
6239
+ const { fs } = entry;
6240
+ const { owner } = mkdirOptions(entry, mode);
6241
+ const own = owner ? { owner } : {};
6242
+ try {
6243
+ await fs.mkdir(path, own);
6244
+ } catch (err) {
6245
+ if (err?.code !== "ENOENT") throw err;
6246
+ const above = owner ? { owner: { ...owner, mode: owner.parents } } : {};
6247
+ await fs.mkdir(path.slice(0, path.lastIndexOf("/")) || "/", { recursive: true, ...above });
6248
+ await fs.mkdir(path, own);
6249
+ }
6250
+ }
6237
6251
  async function chown(entry, path, req) {
6238
6252
  const cred = entry.cred?.();
6239
6253
  if (!cred) {
@@ -6266,7 +6280,7 @@ async function run(entry, path, req) {
6266
6280
  case "readdir-stat":
6267
6281
  return json2(await readdirStat(fs, path));
6268
6282
  case "mkdir":
6269
- await fs.mkdir(path, mkdirOptions(entry, req.mode));
6283
+ await (req.exclusive ? mkdirExclusive(entry, path, req.mode) : fs.mkdir(path, mkdirOptions(entry, req.mode)));
6270
6284
  return done;
6271
6285
  case "rm":
6272
6286
  await fs.rm(path, { recursive: true });