@@ -112,6 +112,9 @@ exec('my.bat', (err, stdout, stderr) => {
112
112
```
113
113
114
114
### child_process.exec(command[ , options] [ , callback ] )
115
+ <!-- YAML
116
+ added: v0.1.90
117
+ -->
115
118
116
119
* ` command ` {String} The command to run, with space-separated arguments
117
120
* ` options ` {Object}
@@ -189,6 +192,9 @@ terminated.
189
192
replace the existing process and uses a shell to execute the command.*
190
193
191
194
### child_process.execFile(file[ , args] [ , options ] [ , callback] )
195
+ <!-- YAML
196
+ added: v0.1.91
197
+ -->
192
198
193
199
* ` file ` {String} The name or path of the executable file to run
194
200
* ` args ` {Array} List of string arguments
@@ -234,6 +240,9 @@ stderr output. If `encoding` is `'buffer'`, or an unrecognized character
234
240
encoding, ` Buffer ` objects will be passed to the callback instead.
235
241
236
242
### child_process.fork(modulePath[ , args] [ , options ] )
243
+ <!-- YAML
244
+ added: v0.5.0
245
+ -->
237
246
238
247
* ` modulePath ` {String} The module to run in the child
239
248
* ` args ` {Array} List of string arguments
@@ -278,6 +287,9 @@ output on this fd is expected to be line delimited JSON objects.
278
287
not clone the current process.*
279
288
280
289
### child_process.spawn(command[ , args] [ , options ] )
290
+ <!-- YAML
291
+ added: v0.1.90
292
+ -->
281
293
282
294
* ` command ` {String} The command to run
283
295
* ` args ` {Array} List of string arguments
@@ -383,6 +395,9 @@ child.on('error', (err) => {
383
395
```
384
396
385
397
#### options.detached
398
+ <!-- YAML
399
+ added: v0.7.10
400
+ -->
386
401
387
402
On Windows, setting ` options.detached ` to ` true ` makes it possible for the
388
403
child process to continue running after the parent exits. The child will have
@@ -437,6 +452,9 @@ child.unref();
437
452
```
438
453
439
454
#### options.stdio
455
+ <!-- YAML
456
+ added: v0.7.10
457
+ -->
440
458
441
459
The ` options.stdio ` option is used to configure the pipes that are established
442
460
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
523
541
configuration at startup.
524
542
525
543
### child_process.execFileSync(file[ , args] [ , options ] )
544
+ <!-- YAML
545
+ added: v0.11.12
546
+ -->
526
547
527
548
* ` file ` {String} The name or path of the executable file to run
528
549
* ` args ` {Array} List of string arguments
@@ -556,6 +577,9 @@ throw. The [`Error`][] object will contain the entire result from
556
577
[ ` child_process.spawnSync() ` ] [ ]
557
578
558
579
### child_process.execSync(command[ , options] )
580
+ <!-- YAML
581
+ added: v0.11.12
582
+ -->
559
583
560
584
* ` command ` {String} The command to run
561
585
* ` options ` {Object}
@@ -592,6 +616,9 @@ throw. The [`Error`][] object will contain the entire result from
592
616
[ ` child_process.spawnSync() ` ] [ ]
593
617
594
618
### child_process.spawnSync(command[ , args] [ , options ] )
619
+ <!-- YAML
620
+ added: v0.11.12
621
+ -->
595
622
596
623
* ` command ` {String} The command to run
597
624
* ` args ` {Array} List of string arguments
@@ -626,6 +653,9 @@ completely exited. Note that if the process intercepts and handles the
626
653
process has exited.
627
654
628
655
## Class: ChildProcess
656
+ <!-- YAML
657
+ added: v2.2.0
658
+ -->
629
659
630
660
Instances of the ` ChildProcess ` class are [ ` EventEmitters ` ] [ ] that represent
631
661
spawned child processes.
@@ -636,6 +666,9 @@ use the [`child_process.spawn()`][], [`child_process.exec()`][],
636
666
instances of ` ChildProcess ` .
637
667
638
668
### Event: 'close'
669
+ <!-- YAML
670
+ added: v0.7.7
671
+ -->
639
672
640
673
* ` code ` {Number} the exit code if the child exited on its own.
641
674
* ` 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
645
678
processes might share the same stdio streams.
646
679
647
680
### Event: 'disconnect'
681
+ <!-- YAML
682
+ added: v0.7.2
683
+ -->
648
684
649
685
The ` 'disconnect' ` event is emitted after calling the
650
686
` ChildProcess.disconnect() ` method in the parent or child process. After
651
687
disconnecting it is no longer possible to send or receive messages, and the
652
688
` ChildProcess.connected ` property is false.
653
689
654
- ### Event: 'error'
690
+ ### Event: 'error'
655
691
656
692
* ` err ` {Error} the error.
657
693
@@ -667,7 +703,10 @@ to guard against accidentally invoking handler functions multiple times.
667
703
668
704
See also [ ` ChildProcess#kill() ` ] [ ] and [ ` ChildProcess#send() ` ] [ ] .
669
705
670
- ### Event: 'exit'
706
+ ### Event: 'exit'
707
+ <!-- YAML
708
+ added: v0.1.90
709
+ -->
671
710
672
711
* ` code ` {Number} the exit code if the child exited on its own.
673
712
* ` signal ` {String} the signal by which the child process was terminated.
@@ -688,6 +727,9 @@ and then will re-raise the handled signal.
688
727
See ` waitpid(2) ` .
689
728
690
729
### Event: 'message'
730
+ <!-- YAML
731
+ added: v0.5.9
732
+ -->
691
733
692
734
* ` message ` {Object} a parsed JSON object or primitive value.
693
735
* ` 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()`
697
739
to send messages.
698
740
699
741
### child.connected
742
+ <!-- YAML
743
+ added: v0.7.2
744
+ -->
700
745
701
746
* {Boolean} Set to false after ` .disconnect ` is called
702
747
@@ -705,6 +750,9 @@ and receive messages from a child process. When `child.connected` is false, it
705
750
is no longer possible to send or receive messages.
706
751
707
752
### child.disconnect()
753
+ <!-- YAML
754
+ added: v0.7.2
755
+ -->
708
756
709
757
Closes the IPC channel between parent and child, allowing the child to exit
710
758
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
721
769
within the child process to close the IPC channel as well.
722
770
723
771
### child.kill([ signal] )
772
+ <!-- YAML
773
+ added: v0.1.90
774
+ -->
724
775
725
776
* ` signal ` {String}
726
777
@@ -775,6 +826,9 @@ setTimeout(() => {
775
826
```
776
827
777
828
### child.pid
829
+ <!-- YAML
830
+ added: v0.1.90
831
+ -->
778
832
779
833
* {Number} Integer
780
834
@@ -791,6 +845,9 @@ grep.stdin.end();
791
845
```
792
846
793
847
### child.send(message[ , sendHandle] [ , callback ] )
848
+ <!-- YAML
849
+ added: v0.5.9
850
+ -->
794
851
795
852
* ` message ` {Object}
796
853
* ` sendHandle ` {Handle}
@@ -936,6 +993,9 @@ this occurs.
936
993
* Note: this function uses [ ` JSON.stringify() ` ] [ ] internally to serialize the ` message ` .*
937
994
938
995
### child.stderr
996
+ <!-- YAML
997
+ added: v0.1.90
998
+ -->
939
999
940
1000
* {Stream}
941
1001
@@ -948,6 +1008,9 @@ then this will be `undefined`.
948
1008
the same value.
949
1009
950
1010
### child.stdin
1011
+ <!-- YAML
1012
+ added: v0.1.90
1013
+ -->
951
1014
952
1015
* {Stream}
953
1016
@@ -963,6 +1026,9 @@ then this will be `undefined`.
963
1026
the same value.
964
1027
965
1028
### child.stdio
1029
+ <!-- YAML
1030
+ added: v0.7.10
1031
+ -->
966
1032
967
1033
* {Array}
968
1034
@@ -1000,6 +1066,9 @@ assert.equal(child.stdio[2], child.stderr);
1000
1066
```
1001
1067
1002
1068
### child.stdout
1069
+ <!-- YAML
1070
+ added: v0.1.90
1071
+ -->
1003
1072
1004
1073
* {Stream}
1005
1074
0 commit comments