From c088434b4d481ab4abe210077f8c4300155bf500 Mon Sep 17 00:00:00 2001 From: FeelyChau Date: Fri, 24 Jul 2020 22:43:05 +0800 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/34505 Reviewed-By: Antoine du Hamel Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil --- 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 bfe7850ad0ddd3..2b6fabc3e1d293 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -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`][].