Skip to content

Commit

Permalink
doc: document the error when cwd not exists in child_process.spawn
Browse files Browse the repository at this point in the history
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 <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
FeelyChau authored and codebytere committed Nov 22, 2020
1 parent 6349b1d commit eefc6aa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,10 @@ const defaults = {
```

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

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

0 comments on commit eefc6aa

Please sign in to comment.