@@ -113,6 +113,9 @@ exec('my.bat', (err, stdout, stderr) => {
113
113
```
114
114
115
115
### child_process.exec(command[ , options] [ , callback ] )
116
+ <!-- YAML
117
+ added: v0.1.90
118
+ -->
116
119
117
120
* ` command ` {String} The command to run, with space-separated arguments
118
121
* ` options ` {Object}
@@ -186,6 +189,9 @@ child runs longer than `timeout` milliseconds.
186
189
replace the existing process and uses a shell to execute the command.*
187
190
188
191
### child_process.execFile(file[ , args] [ , options ] [ , callback] )
192
+ <!-- YAML
193
+ added: v0.1.91
194
+ -->
189
195
190
196
* ` file ` {String} The name or path of the executable file to run
191
197
* ` args ` {Array} List of string arguments
@@ -231,6 +237,9 @@ stderr output. If `encoding` is `'buffer'`, `Buffer` objects will be passed to
231
237
the callback instead.
232
238
233
239
### child_process.fork(modulePath[ , args] [ , options ] )
240
+ <!-- YAML
241
+ added: v0.5.0
242
+ -->
234
243
235
244
* ` modulePath ` {String} The module to run in the child
236
245
* ` args ` {Array} List of string arguments
@@ -275,6 +284,9 @@ output on this fd is expected to be line delimited JSON objects.
275
284
not clone the current process.*
276
285
277
286
### child_process.spawn(command[ , args] [ , options ] )
287
+ <!-- YAML
288
+ added: v0.1.90
289
+ -->
278
290
279
291
* ` command ` {String} The command to run
280
292
* ` args ` {Array} List of string arguments
@@ -384,6 +396,9 @@ child.on('error', (err) => {
384
396
```
385
397
386
398
#### options.detached
399
+ <!-- YAML
400
+ added: v0.7.10
401
+ -->
387
402
388
403
On Windows, setting ` options.detached ` to ` true ` makes it possible for the
389
404
child process to continue running after the parent exits. The child will have
@@ -438,6 +453,9 @@ child.unref();
438
453
```
439
454
440
455
#### options.stdio
456
+ <!-- YAML
457
+ added: v0.7.10
458
+ -->
441
459
442
460
The ` options.stdio ` option is used to configure the pipes that are established
443
461
between the parent and child process. By default, the child's stdin, stdout,
@@ -524,6 +542,9 @@ scripting tasks and for simplifying the loading/processing of application
524
542
configuration at startup.
525
543
526
544
### child_process.execFileSync(file[ , args] [ , options ] )
545
+ <!-- YAML
546
+ added: v0.11.12
547
+ -->
527
548
528
549
* ` file ` {String} The name or path of the executable file to run
529
550
* ` args ` {Array} List of string arguments
@@ -560,6 +581,9 @@ throw. The [`Error`][] object will contain the entire result from
560
581
[ ` child_process.spawnSync() ` ] [ ]
561
582
562
583
### child_process.execSync(command[ , options] )
584
+ <!-- YAML
585
+ added: v0.11.12
586
+ -->
563
587
564
588
* ` command ` {String} The command to run
565
589
* ` options ` {Object}
@@ -600,6 +624,9 @@ throw. The [`Error`][] object will contain the entire result from
600
624
[ ` child_process.spawnSync() ` ] [ ]
601
625
602
626
### child_process.spawnSync(command[ , args] [ , options ] )
627
+ <!-- YAML
628
+ added: v0.11.12
629
+ -->
603
630
604
631
* ` command ` {String} The command to run
605
632
* ` args ` {Array} List of string arguments
@@ -642,6 +669,9 @@ completely exited. Note that if the process intercepts and handles the
642
669
process has exited.
643
670
644
671
## Class: ChildProcess
672
+ <!-- YAML
673
+ added: v2.2.0
674
+ -->
645
675
646
676
Instances of the ` ChildProcess ` class are [ ` EventEmitters ` ] [ `EventEmitter` ] that represent
647
677
spawned child processes.
@@ -652,6 +682,9 @@ use the [`child_process.spawn()`][], [`child_process.exec()`][],
652
682
instances of ` ChildProcess ` .
653
683
654
684
### Event: 'close'
685
+ <!-- YAML
686
+ added: v0.7.7
687
+ -->
655
688
656
689
* ` code ` {Number} the exit code if the child exited on its own.
657
690
* ` signal ` {String} the signal by which the child process was terminated.
@@ -661,13 +694,16 @@ been closed. This is distinct from the [`'exit'`][] event, since multiple
661
694
processes might share the same stdio streams.
662
695
663
696
### Event: 'disconnect'
697
+ <!-- YAML
698
+ added: v0.7.2
699
+ -->
664
700
665
701
The ` 'disconnect' ` event is emitted after calling the
666
702
[ ` child.disconnect() ` ] [ ] method in parent process or [ ` process.disconnect() ` ] [ ] in child process. After
667
703
disconnecting it is no longer possible to send or receive messages, and the
668
704
[ ` child.connected ` ] [ ] property is ` false ` .
669
705
670
- ### Event: 'error'
706
+ ### Event: 'error'
671
707
672
708
* ` err ` {Error} the error.
673
709
@@ -683,7 +719,10 @@ to guard against accidentally invoking handler functions multiple times.
683
719
684
720
See also [ ` child.kill() ` ] [ ] and [ ` child.send() ` ] [ ] .
685
721
686
- ### Event: 'exit'
722
+ ### Event: 'exit'
723
+ <!-- YAML
724
+ added: v0.1.90
725
+ -->
687
726
688
727
* ` code ` {Number} the exit code if the child exited on its own.
689
728
* ` signal ` {String} the signal by which the child process was terminated.
@@ -704,6 +743,9 @@ and then will re-raise the handled signal.
704
743
See waitpid(2).
705
744
706
745
### Event: 'message'
746
+ <!-- YAML
747
+ added: v0.5.9
748
+ -->
707
749
708
750
* ` message ` {Object} a parsed JSON object or primitive value.
709
751
* ` sendHandle ` {Handle} a [ ` net.Socket ` ] [ ] or [ ` net.Server ` ] [ ] object, or
@@ -713,6 +755,9 @@ The `'message'` event is triggered when a child process uses [`process.send()`][
713
755
to send messages.
714
756
715
757
### child.connected
758
+ <!-- YAML
759
+ added: v0.7.2
760
+ -->
716
761
717
762
* {Boolean} Set to ` false ` after ` child.disconnect() ` is called
718
763
@@ -721,6 +766,9 @@ and receive messages from a child process. When `child.connected` is `false`, it
721
766
is no longer possible to send or receive messages.
722
767
723
768
### child.disconnect()
769
+ <!-- YAML
770
+ added: v0.7.2
771
+ -->
724
772
725
773
Closes the IPC channel between parent and child, allowing the child to exit
726
774
gracefully once there are no other connections keeping it alive. After calling
@@ -737,6 +785,9 @@ Note that when the child process is a Node.js instance (e.g. spawned using
737
785
within the child process to close the IPC channel as well.
738
786
739
787
### child.kill([ signal] )
788
+ <!-- YAML
789
+ added: v0.1.90
790
+ -->
740
791
741
792
* ` signal ` {String}
742
793
@@ -791,6 +842,9 @@ setTimeout(() => {
791
842
```
792
843
793
844
### child.pid
845
+ <!-- YAML
846
+ added: v0.1.90
847
+ -->
794
848
795
849
* {Number} Integer
796
850
@@ -807,6 +861,9 @@ grep.stdin.end();
807
861
```
808
862
809
863
### child.send(message[ , sendHandle[ , options]] [ , callback ] )
864
+ <!-- YAML
865
+ added: v0.5.9
866
+ -->
810
867
811
868
* ` message ` {Object}
812
869
* ` sendHandle ` {Handle}
@@ -962,6 +1019,9 @@ this occurs.
962
1019
` message ` .*
963
1020
964
1021
### child.stderr
1022
+ <!-- YAML
1023
+ added: v0.1.90
1024
+ -->
965
1025
966
1026
* {Stream}
967
1027
@@ -974,6 +1034,9 @@ then this will be `undefined`.
974
1034
the same value.
975
1035
976
1036
### child.stdin
1037
+ <!-- YAML
1038
+ added: v0.1.90
1039
+ -->
977
1040
978
1041
* {Stream}
979
1042
@@ -989,6 +1052,9 @@ then this will be `undefined`.
989
1052
the same value.
990
1053
991
1054
### child.stdio
1055
+ <!-- YAML
1056
+ added: v0.7.10
1057
+ -->
992
1058
993
1059
* {Array}
994
1060
@@ -1026,6 +1092,9 @@ assert.equal(child.stdio[2], child.stderr);
1026
1092
```
1027
1093
1028
1094
### child.stdout
1095
+ <!-- YAML
1096
+ added: v0.1.90
1097
+ -->
1029
1098
1030
1099
* {Stream}
1031
1100
0 commit comments