sandboxedjs 0.1.68 → 0.1.69

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/index.cjs CHANGED
@@ -17970,7 +17970,7 @@ var wheels_default = {
17970
17970
 
17971
17971
  // package.json
17972
17972
  var package_default = {
17973
- version: "0.1.68"};
17973
+ version: "0.1.69"};
17974
17974
 
17975
17975
  // src/runtime/python/config.ts
17976
17976
  var bundledManifest = {
@@ -19884,7 +19884,11 @@ async function startPythonProcess(options) {
19884
19884
  pid: options.pid,
19885
19885
  ppid: options.ppid,
19886
19886
  mounts: options.mounts,
19887
- isTty: options.isTty
19887
+ isTty: options.isTty,
19888
+ /* Only beyond the standard three: 0, 1 and 2 are bound as the process's
19889
+ * terminal-or-pipe streams by the worker itself, and installing a second
19890
+ * stream over one of them would leave two objects claiming the number. */
19891
+ inheritFds: [...options.inherit?.keys() ?? []].filter((fd) => fd > 2)
19888
19892
  });
19889
19893
  return {
19890
19894
  write: (data) => stdin.push(data),
@@ -20407,13 +20411,9 @@ function createProcessService(ctx) {
20407
20411
  return {
20408
20412
  async spawn(request) {
20409
20413
  const token = `${ctx.proc.pid}:${Math.random().toString(36).slice(2)}`;
20410
- const extra = /* @__PURE__ */ new Map();
20411
- for (const [fd, description] of request.files) {
20412
- if (fd > 2) extra.set(fd, description);
20413
- }
20414
20414
  const env2 = { ...request.env };
20415
- if (extra.size > 0) {
20416
- PENDING_INHERITANCE.set(token, extra);
20415
+ if (request.files.size > 0) {
20416
+ PENDING_INHERITANCE.set(token, new Map(request.files));
20417
20417
  env2[INHERIT_TOKEN] = token;
20418
20418
  }
20419
20419
  const stdin = request.files.get(0);