Skip to content

Commit eefc6aa

Browse files
FeelyChaucodebytere
authored andcommitted
doc: document the error when cwd not exists in child_process.spawn
If the option cwd does not exist, the error ENOENT is the same as the error emitted when the command does not exist, it's confusing. PR-URL: #34505 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
1 parent 6349b1d commit eefc6aa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/api/child_process.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,10 @@ const defaults = {
469469
```
470470

471471
Use `cwd` to specify the working directory from which the process is spawned.
472-
If not given, the default is to inherit the current working directory.
472+
If not given, the default is to inherit the current working directory. If given,
473+
but the path does not exist, the child process emits an `ENOENT` error
474+
and exits immediately. `ENOENT` is also emitted when the command
475+
does not exist.
473476

474477
Use `env` to specify environment variables that will be visible to the new
475478
process, the default is [`process.env`][].

0 commit comments

Comments
 (0)