Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: update spawnSync() status value possibilities
The object returned by `child_process.spawnSync()` can have the `status`
property set to `null` if the process terminated due to a signal. We
even test for this in
test/parallel/test-child-process-spawnsync-kill-signal.js.

Update the documentation to reflect this.
  • Loading branch information
Trott committed Mar 15, 2019
commit 162e6444d3452610db7fede1e0e85fb14aecb67e
3 changes: 2 additions & 1 deletion doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,8 @@ changes:
* `output` {Array} Array of results from stdio output.
* `stdout` {Buffer|string} The contents of `output[1]`.
* `stderr` {Buffer|string} The contents of `output[2]`.
* `status` {number} The exit code of the child process.
* `status` {number|null} The exit code of the subprocess, or `null` if the
child process exited due to a signal.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"exited due to a signal" --> "terminated due to a signal" (if it terminated due to a signal, it didn't exit, which is why there is no exit code).

the signal docs below have the same problem, they should be changed to something like

The signal that terminated the child process, or null if the child process exited.

(or "if the child process terminated due to exiting.", but that is maybe too verbose).

Perhaps its obvious from the above, but you may want to emphasize that either status will be non-null, or signal will be non-null, but they will NEVER both have non-null values.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sam-github OK, I think I've addressed this. I went with end due to signal instead of terminate due to signal. PTAL.

* `signal` {string} The signal used to kill the child process.
* `error` {Error} The error object if the child process failed or timed out.

Expand Down