Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ec90384

Browse filesBrowse files
addaleaxMyles Borins
authored andcommitted
doc: add added: information for child_process
Ref: #6578 PR-URL: #6927 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent e52b2b0 commit ec90384
Copy full SHA for ec90384

File tree

Expand file treeCollapse file tree

1 file changed

+71
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+71
-2
lines changed
Open diff view settings
Collapse file

‎doc/api/child_process.md‎

Copy file name to clipboardExpand all lines: doc/api/child_process.md
+71-2Lines changed: 71 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ exec('my.bat', (err, stdout, stderr) => {
112112
```
113113

114114
### child_process.exec(command[, options][, callback])
115+
<!-- YAML
116+
added: v0.1.90
117+
-->
115118

116119
* `command` {String} The command to run, with space-separated arguments
117120
* `options` {Object}
@@ -189,6 +192,9 @@ terminated.
189192
replace the existing process and uses a shell to execute the command.*
190193

191194
### child_process.execFile(file[, args][, options][, callback])
195+
<!-- YAML
196+
added: v0.1.91
197+
-->
192198

193199
* `file` {String} The name or path of the executable file to run
194200
* `args` {Array} List of string arguments
@@ -234,6 +240,9 @@ stderr output. If `encoding` is `'buffer'`, or an unrecognized character
234240
encoding, `Buffer` objects will be passed to the callback instead.
235241

236242
### child_process.fork(modulePath[, args][, options])
243+
<!-- YAML
244+
added: v0.5.0
245+
-->
237246

238247
* `modulePath` {String} The module to run in the child
239248
* `args` {Array} List of string arguments
@@ -278,6 +287,9 @@ output on this fd is expected to be line delimited JSON objects.
278287
not clone the current process.*
279288

280289
### child_process.spawn(command[, args][, options])
290+
<!-- YAML
291+
added: v0.1.90
292+
-->
281293

282294
* `command` {String} The command to run
283295
* `args` {Array} List of string arguments
@@ -383,6 +395,9 @@ child.on('error', (err) => {
383395
```
384396

385397
#### options.detached
398+
<!-- YAML
399+
added: v0.7.10
400+
-->
386401

387402
On Windows, setting `options.detached` to `true` makes it possible for the
388403
child process to continue running after the parent exits. The child will have
@@ -437,6 +452,9 @@ child.unref();
437452
```
438453

439454
#### options.stdio
455+
<!-- YAML
456+
added: v0.7.10
457+
-->
440458

441459
The `options.stdio` option is used to configure the pipes that are established
442460
between the parent and child process. By default, the child's stdin, stdout,
@@ -523,6 +541,9 @@ scripting tasks and for simplifying the loading/processing of application
523541
configuration at startup.
524542

525543
### child_process.execFileSync(file[, args][, options])
544+
<!-- YAML
545+
added: v0.11.12
546+
-->
526547

527548
* `file` {String} The name or path of the executable file to run
528549
* `args` {Array} List of string arguments
@@ -556,6 +577,9 @@ throw. The [`Error`][] object will contain the entire result from
556577
[`child_process.spawnSync()`][]
557578

558579
### child_process.execSync(command[, options])
580+
<!-- YAML
581+
added: v0.11.12
582+
-->
559583

560584
* `command` {String} The command to run
561585
* `options` {Object}
@@ -592,6 +616,9 @@ throw. The [`Error`][] object will contain the entire result from
592616
[`child_process.spawnSync()`][]
593617

594618
### child_process.spawnSync(command[, args][, options])
619+
<!-- YAML
620+
added: v0.11.12
621+
-->
595622

596623
* `command` {String} The command to run
597624
* `args` {Array} List of string arguments
@@ -626,6 +653,9 @@ completely exited. Note that if the process intercepts and handles the
626653
process has exited.
627654

628655
## Class: ChildProcess
656+
<!-- YAML
657+
added: v2.2.0
658+
-->
629659

630660
Instances of the `ChildProcess` class are [`EventEmitters`][] that represent
631661
spawned child processes.
@@ -636,6 +666,9 @@ use the [`child_process.spawn()`][], [`child_process.exec()`][],
636666
instances of `ChildProcess`.
637667

638668
### Event: 'close'
669+
<!-- YAML
670+
added: v0.7.7
671+
-->
639672

640673
* `code` {Number} the exit code if the child exited on its own.
641674
* `signal` {String} the signal by which the child process was terminated.
@@ -645,13 +678,16 @@ been closed. This is distinct from the `'exit'` event, since multiple
645678
processes might share the same stdio streams.
646679

647680
### Event: 'disconnect'
681+
<!-- YAML
682+
added: v0.7.2
683+
-->
648684

649685
The `'disconnect'` event is emitted after calling the
650686
`ChildProcess.disconnect()` method in the parent or child process. After
651687
disconnecting it is no longer possible to send or receive messages, and the
652688
`ChildProcess.connected` property is false.
653689

654-
### Event: 'error'
690+
### Event: 'error'
655691

656692
* `err` {Error} the error.
657693

@@ -667,7 +703,10 @@ to guard against accidentally invoking handler functions multiple times.
667703

668704
See also [`ChildProcess#kill()`][] and [`ChildProcess#send()`][].
669705

670-
### Event: 'exit'
706+
### Event: 'exit'
707+
<!-- YAML
708+
added: v0.1.90
709+
-->
671710

672711
* `code` {Number} the exit code if the child exited on its own.
673712
* `signal` {String} the signal by which the child process was terminated.
@@ -688,6 +727,9 @@ and then will re-raise the handled signal.
688727
See `waitpid(2)`.
689728

690729
### Event: 'message'
730+
<!-- YAML
731+
added: v0.5.9
732+
-->
691733

692734
* `message` {Object} a parsed JSON object or primitive value.
693735
* `sendHandle` {Handle} a [`net.Socket`][] or [`net.Server`][] object, or
@@ -697,6 +739,9 @@ The `'message'` event is triggered when a child process uses `process.send()`
697739
to send messages.
698740

699741
### child.connected
742+
<!-- YAML
743+
added: v0.7.2
744+
-->
700745

701746
* {Boolean} Set to false after `.disconnect` is called
702747

@@ -705,6 +750,9 @@ and receive messages from a child process. When `child.connected` is false, it
705750
is no longer possible to send or receive messages.
706751

707752
### child.disconnect()
753+
<!-- YAML
754+
added: v0.7.2
755+
-->
708756

709757
Closes the IPC channel between parent and child, allowing the child to exit
710758
gracefully once there are no other connections keeping it alive. After calling
@@ -721,6 +769,9 @@ Note that when the child process is a Node.js instance (e.g. spawned using
721769
within the child process to close the IPC channel as well.
722770

723771
### child.kill([signal])
772+
<!-- YAML
773+
added: v0.1.90
774+
-->
724775

725776
* `signal` {String}
726777

@@ -775,6 +826,9 @@ setTimeout(() => {
775826
```
776827

777828
### child.pid
829+
<!-- YAML
830+
added: v0.1.90
831+
-->
778832

779833
* {Number} Integer
780834

@@ -791,6 +845,9 @@ grep.stdin.end();
791845
```
792846

793847
### child.send(message[, sendHandle][, callback])
848+
<!-- YAML
849+
added: v0.5.9
850+
-->
794851

795852
* `message` {Object}
796853
* `sendHandle` {Handle}
@@ -936,6 +993,9 @@ this occurs.
936993
*Note: this function uses [`JSON.stringify()`][] internally to serialize the `message`.*
937994

938995
### child.stderr
996+
<!-- YAML
997+
added: v0.1.90
998+
-->
939999

9401000
* {Stream}
9411001

@@ -948,6 +1008,9 @@ then this will be `undefined`.
9481008
the same value.
9491009

9501010
### child.stdin
1011+
<!-- YAML
1012+
added: v0.1.90
1013+
-->
9511014

9521015
* {Stream}
9531016

@@ -963,6 +1026,9 @@ then this will be `undefined`.
9631026
the same value.
9641027

9651028
### child.stdio
1029+
<!-- YAML
1030+
added: v0.7.10
1031+
-->
9661032

9671033
* {Array}
9681034

@@ -1000,6 +1066,9 @@ assert.equal(child.stdio[2], child.stderr);
10001066
```
10011067

10021068
### child.stdout
1069+
<!-- YAML
1070+
added: v0.1.90
1071+
-->
10031072

10041073
* {Stream}
10051074

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.