Skip to content

Commit

Permalink
doc: describe spawn option.detached
Browse files Browse the repository at this point in the history
PR-URL: #2903
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
sam-github authored and Fishrock123 committed Sep 16, 2015
1 parent f931b9d commit 74db963
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions doc/api/child_process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ callback or returning an EventEmitter).
* `env` {Object} Environment key-value pairs
* `stdio` {Array|String} Child's stdio configuration. (See
[below](#child_process_options_stdio))
* `detached` {Boolean} The child will be a process group leader. (See
* `detached` {Boolean} Prepare child to run independently of its parent
process. Specific behavior depends on the platform, see
[below](#child_process_options_detached))
* `uid` {Number} Sets the user identity of the process. (See setuid(2).)
* `gid` {Number} Sets the group identity of the process. (See setgid(2).)
Expand Down Expand Up @@ -505,9 +506,14 @@ Example:

#### options.detached

If the `detached` option is set, the child process will be made the leader of a
new process group. This makes it possible for the child to continue running
after the parent exits.
On Windows, this makes it possible for the child to continue running after the
parent exits. The child will have a new console window (this cannot be
disabled).

On non-Windows, if the `detached` option is set, the child process will be made
the leader of a new process group and session. Note that child processes may
continue running after the parent exits whether they are detached or not. See
`setsid(2)` for more information.

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

0 comments on commit 74db963

Please sign in to comment.