From 9b896d7b70317c5706de857308ef76fc314fc7bb Mon Sep 17 00:00:00 2001 From: FeelyChau Date: Fri, 24 Jul 2020 22:43:05 +0800 Subject: [PATCH 1/2] 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. --- doc/api/child_process.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index d88adf49885b11..919c9ad12b5c11 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -466,7 +466,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 will emit an `ENOENT` then +exit immediately, **this is the same as the error 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`][]. From cb14deaddc7fb926489f00cc554e07e10e791085 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 11 Nov 2020 17:43:41 -0800 Subject: [PATCH 2/2] Update doc/api/child_process.md --- doc/api/child_process.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 919c9ad12b5c11..31e2093f6e1eef 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -467,9 +467,9 @@ 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 given, -but the path does not exist, the child process will emit an `ENOENT` then -exit immediately, **this is the same as the error emitted when the command -does not exist**. +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`][].