Skip to content

fix(node): honor child_process exec buffer encoding#1956

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-child-process-buffer-encoding
May 27, 2026
Merged

fix(node): honor child_process exec buffer encoding#1956
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-child-process-buffer-encoding

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Fixes part of #1937.

Summary

  • Honor async child_process.exec() / execFile() encoding: "buffer" and encoding: null for callback stdout/stderr values.
  • Route those outputs through Perry's existing Buffer allocator while preserving the default string output path.
  • Add a focused node-suite fixture covering exec(..., { encoding: "buffer" }), execFile(..., { encoding: null }), and default string output.

Baseline

  • Node passed Buffers for stdout/stderr under encoding: "buffer" and encoding: null.
  • Perry previously passed strings, so Buffer.isBuffer(stdout) was false and stdout.toString("hex") returned the original text instead of hex bytes.

Reference

  • DeepWiki comparison saved locally only at reference/deepwiki/deno-node-child-process-exec-encoding-buffer-2026-05-27.md.
  • Extracted invariant: default output is UTF-8 strings; encoding: "buffer" or null produces Buffer stdout/stderr; exec shares execFile encoding behavior.

Tests

  • PERRY_NO_CACHE=1 ./run_parity_tests.sh --suite node-suite --module child_process --filter exec-encoding-buffer
  • PERRY_NO_CACHE=1 ./run_parity_tests.sh --suite node-suite --module child_process
  • PERRY_NO_CACHE=1 ./run_parity_tests.sh --filter test_parity_child_process
  • cargo test -p perry-runtime child_process --lib
  • cargo fmt --all -- --check
  • jq empty test-parity/known_failures.json
  • git diff --check

Non-goals

  • Sync execSync / execFileSync return ABI changes.
  • spawnSync Buffer-vs-string result output shape.
  • Named non-UTF8 encodings such as hex, unknown-encoding fallback behavior, or full encoding validation.
  • Promisified exec output, timeout/maxBuffer handling, streaming subprocess IO, kill behavior, or IPC/fork.

@proggeramlug proggeramlug merged commit 10ebbe4 into PerryTS:main May 27, 2026
10 checks passed
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