-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.
Description
📗 API Reference Docs Problem
- Version: v13.9.0
- Platform: Mac OS 10.15.4
- Subsystem: child_process
Location
Section of the site where the content exists
Affected URL(s):
- https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options
Problem description
Concise explanation of what you found to be problematic
In the "Returns" desciption it states that "stdout" and "stderr" can be <Buffer>
or <string>
and that "output" is of type <Array>
.
However, this is not the case when the spawned process terminates with an error.
To reproduce you can run the following script:
const child_process = require("child_process")
// any command that is not available or fails with an error
const result = child_process.spawnSync("not_found")
console.log(result)
will output:
{
error: Error: spawnSync not_found ENOENT
at Object.spawnSync (internal/child_process.js:1045:20)
...
errno: -2,
code: 'ENOENT',
syscall: 'spawnSync not_found',
path: 'not_found',
spawnargs: []
},
status: null,
signal: null,
output: null,
pid: 36085,
stdout: null,
stderr: null
}
As you can see "stdout", "stderr" and "output" are null
.
I'm not sure if this is a bug in the implementation or if this is the desired behavior. In the latter case it should be stated in the docs that these three fields can also be null and under which conditions this is the case.
- I would like to work on this issue and submit a pull request.
DerekNonGeneric, ssmirr, eps1lon and eherozhao
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.