From afb3ef48a19bca6719405d5356beb6e056e97192 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 29 Oct 2025 11:50:19 -0400 Subject: [PATCH] doc: `process.execve`: add example for restarting current process This clarifies that the second `args` argument includes the `argv[0]` of the new process. A naive assumption is to think that this is similar to `child_process` functions like `execFile` which expect only the actual arguments. --- doc/api/process.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/api/process.md b/doc/api/process.md index 3eaa17be6144dd..0192ac8e80d11a 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1720,6 +1720,13 @@ This function will never return, unless an error occurred. This function is not available on Windows or IBM i. +For example, the following restarts the current process in the same way it started, +modulo changes to `process.chdir(...)`, `process.env`, `process.argv`. + +```js + process.execve(process.argv0, process.argv); +``` + ## `process.exit([code])`