Skip to content

feat: support node:process's execve()#32586

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-node-process-execve-support
Draft

feat: support node:process's execve()#32586
Copilot wants to merge 4 commits intomainfrom
copilot/add-node-process-execve-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 9, 2026

Implements process.execve() from Node.js 22.15.0 LTS, which replaces the current process via the POSIX execve syscall. Unix-only, experimental.

import process from "node:process";

process.execve("/usr/bin/env", ["env", "echo", "hello"], { ...process.env });
// process is replaced — this line never runs

Changes

  • ext/node/ops/process.rs: New op_node_process_execve — converts args/env to CStrings, calls libc::execve. Returns NotSupported on non-Unix. Gated behind check_run_all.
  • ext/node/polyfills/process.ts: JS execve() with Node-matching validation (execPath, args, env null-byte checks), worker thread guard (ERR_WORKER_UNSUPPORTED_OPERATION), platform guard (ERR_FEATURE_UNAVAILABLE_ON_PLATFORM). Only exposed on non-Windows.
  • ext/node/lib.rs: Op registration.
  • tests/specs/node/process_execve/: Spec test covering the end-to-end replace-and-verify flow.
  • tests/node_compat/config.jsonc: Added test-process-execve-validation.js and test-process-execve-worker-threads.js (both passing).

Note on test-process-execve.js

The main Node.js compat test calls execve to re-invoke the deno binary without -A, so the replacement process lacks permissions. This is inherent to execve replacing the process image. The validation and worker-thread tests pass; the end-to-end flow is covered by the spec test which includes -A in the replacement args.

Original prompt

This section details on the original issue you should resolve

<issue_title>Support node:process's execve()</issue_title>
<issue_description>Node 22.15.0 LTS adds a new execve() function to node:process:

It would be great if Deno supported it. This function is very difficult to mimic otherwise, requiring interfacing with system native APIs (example).</issue_description>

<agent_instructions>Try to implement it - check the docs at https://nodejs.org/api/process.html#processexecvefile-args-env. The relevant file to implement it in is in ext/node/polyfills/process.ts. It would be good to get cargo test --test node_compat test/parallel/test-process-execve.js passing.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@marvinhagemeister Note that this is flagged as "Stability 1 - Experimental" on the Node side, which means it's subject to change at any time, including breaking changes according to their stability tiers.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits March 9, 2026 15:02
Add op_node_process_execve Rust op that calls libc::execve on Unix.
Add JavaScript execve function with input validation in process.ts.
Add spec test for process.execve.

Co-authored-by: bartlomieju <13602871+bartlomieju@users.noreply.github.com>
…ing node_compat tests

Co-authored-by: bartlomieju <13602871+bartlomieju@users.noreply.github.com>
Co-authored-by: bartlomieju <13602871+bartlomieju@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for node:process's execve() function feat: support node:process's execve() Mar 9, 2026
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.

Support node:process's execve()

2 participants