Skip to content

Commit 74db963

Browse files
sam-githubFishrock123
authored andcommitted
doc: describe spawn option.detached
PR-URL: #2903 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent f931b9d commit 74db963

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

doc/api/child_process.markdown

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ callback or returning an EventEmitter).
366366
* `env` {Object} Environment key-value pairs
367367
* `stdio` {Array|String} Child's stdio configuration. (See
368368
[below](#child_process_options_stdio))
369-
* `detached` {Boolean} The child will be a process group leader. (See
369+
* `detached` {Boolean} Prepare child to run independently of its parent
370+
process. Specific behavior depends on the platform, see
370371
[below](#child_process_options_detached))
371372
* `uid` {Number} Sets the user identity of the process. (See setuid(2).)
372373
* `gid` {Number} Sets the group identity of the process. (See setgid(2).)
@@ -505,9 +506,14 @@ Example:
505506

506507
#### options.detached
507508

508-
If the `detached` option is set, the child process will be made the leader of a
509-
new process group. This makes it possible for the child to continue running
510-
after the parent exits.
509+
On Windows, this makes it possible for the child to continue running after the
510+
parent exits. The child will have a new console window (this cannot be
511+
disabled).
512+
513+
On non-Windows, if the `detached` option is set, the child process will be made
514+
the leader of a new process group and session. Note that child processes may
515+
continue running after the parent exits whether they are detached or not. See
516+
`setsid(2)` for more information.
511517

512518
By default, the parent will wait for the detached child to exit. To prevent
513519
the parent from waiting for a given `child`, use the `child.unref()` method,

0 commit comments

Comments
 (0)