Skip to content

[codex] honor sync child_process numeric stdio fds#4342

Closed
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-child-process-stdio-fd-tail
Closed

[codex] honor sync child_process numeric stdio fds#4342
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-child-process-stdio-fd-tail

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

@andrewtdiz andrewtdiz commented Jun 4, 2026

Refs #2555.

Summary

  • Parse sync options.stdio string/array forms for spawnSync(), execFileSync(), and execSync(), including numeric fd entries.
  • Route numeric stdio fds through Perry's registered fs.openSync() file table, with a Unix raw-fd fallback for externally supplied descriptors.
  • Return Node-shaped null stdout/stderr slots when sync stdout/stderr are not piped.
  • Add a Node-suite parity fixture for sync stdout/stderr fd routing, thrown execFileSync() errors, and stdin fd input.

Scope

This is a narrow sync-only slice of #2555. It intentionally leaves live spawn() / fork() numeric fds to #4284 and keeps custom stream handles, invalid-fd validation, AbortSignal/killSignal, uid/gid, detached/platform flags, and broad option validation out of this cut.

Validation

  • PASS: PATH="/root/.npm/_npx/bac97da9607b7ef2/node_modules/node/bin:$PATH" node --experimental-strip-types test-parity/node-suite/child_process/sync/sync-stdio-fd.ts
  • PASS: PERRY_ALLOW_UNIMPLEMENTED=1 PERRY_NO_AUTO_OPTIMIZE=1 PERRY_RUNTIME_DIR=/root/perry-worktrees/perry-node-child-process-stdio-fd-tail/target/debug target/debug/perry compile --no-cache test-parity/node-suite/child_process/sync/sync-stdio-fd.ts -o /tmp/perry_sync_stdio_fd_debugrt
  • PASS: /tmp/perry_sync_stdio_fd_debugrt
  • PASS: CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/perry-child-stdio-fd-check cargo check -p perry-runtime (existing warnings)
  • PASS: cargo build -p perry-runtime (existing warnings)
  • PASS: cargo fmt --all -- --check
  • PASS: git diff --check
  • PASS: ./scripts/check_file_size.sh

The full focused run_parity_tests.sh --suite node-suite --module child_process --filter sync-stdio-fd path could not complete in this environment because the required release compiler/runtime build terminated before producing a binary/report and emitted no Rust diagnostic. The fixture was therefore verified through a direct no-cache Perry compile/run linked against the freshly built debug runtime archive.

@proggeramlug
Copy link
Copy Markdown
Contributor

Superseded by the merged combination of #4284 (CpStdio::Fd + cp_stdio_from_fd + fs::try_clone_registered_fd), #4301 (cp_read_spawn_sync_run_options), and #4304 (cp_read_sync_stdio_run_options). On current main all three sync entry points already read fd-aware stdio — js_child_process_exec_sync and js_child_process_exec_file_sync call cp_read_sync_stdio_run_options, js_child_process_spawn_sync calls cp_read_spawn_sync_run_options, and cp_run_to_completion maps CpStdio::Fd → cp_stdio_from_fd. So numeric stdio fds work end-to-end in the sync APIs without this PR's competing cp_stdio_from_kind refactor. Closing as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants