@@ -12,10 +12,9 @@ data you send to the child process may not be immediately consumed.)
12
12
13
13
To create a child process use ` require('child_process').spawn() ` or
14
14
` require('child_process').fork() ` . The semantics of each are slightly
15
- different, and explained [ below] ( #child_process_asynchronous_process_creation ) .
15
+ different, and explained [ below] [ ] .
16
16
17
- For scripting purposes you may find the
18
- [ synchronous counterparts] ( #child_process_synchronous_process_creation ) more
17
+ For scripting purposes you may find the [ synchronous counterparts] [ ] more
19
18
convenient.
20
19
21
20
## Class: ChildProcess
@@ -61,8 +60,7 @@ Note that the `exit`-event may or may not fire after an error has occurred. If
61
60
you are listening on both events to fire a function, remember to guard against
62
61
calling your function twice.
63
62
64
- See also [ ` ChildProcess#kill() ` ] ( #child_process_child_kill_signal ) and
65
- [ ` ChildProcess#send() ` ] ( #child_process_child_send_message_sendhandle_callback ) .
63
+ See also [ ` ChildProcess#kill() ` ] [ ] and [ ` ChildProcess#send() ` ] [ ] .
66
64
67
65
### Event: 'exit'
68
66
@@ -161,7 +159,7 @@ Example:
161
159
* ` callback ` {Function}
162
160
* Return: Boolean
163
161
164
- When using [ ` child_process.fork() ` ] ( #child_process_child_process_fork_modulepath_args_options ) you can write to the child using
162
+ When using [ ` child_process.fork() ` ] [ ] you can write to the child using
165
163
` child.send(message[, sendHandle][, callback]) ` and messages are received by
166
164
a ` 'message' ` event on the child.
167
165
@@ -310,9 +308,7 @@ to the same object, or null.
310
308
* {Array}
311
309
312
310
A sparse array of pipes to the child process, corresponding with positions in
313
- the [ stdio] ( #child_process_options_stdio ) option to
314
- [ spawn] ( #child_process_child_process_spawn_command_args_options ) that have been
315
- set to ` 'pipe' ` .
311
+ the [ stdio] [ ] option to [ spawn] [ ] that have been set to ` 'pipe' ` .
316
312
Note that streams 0-2 are also available as ChildProcess.stdin,
317
313
ChildProcess.stdout, and ChildProcess.stderr, respectively.
318
314
@@ -439,9 +435,9 @@ the existing process and uses a shell to execute the command.*
439
435
* ` stderr ` {Buffer}
440
436
* Return: ChildProcess object
441
437
442
- This is similar to [ ` child_process.exec() ` ] ( #child_process_child_process_exec_command_options_callback ) except it does not execute a
438
+ This is similar to [ ` child_process.exec() ` ] [ ] except it does not execute a
443
439
subshell but rather the specified file directly. This makes it slightly
444
- leaner than [ ` child_process.exec() ` ] ( #child_process_child_process_exec_command_options_callback ) . It has the same options.
440
+ leaner than [ ` child_process.exec() ` ] [ ] . It has the same options.
445
441
446
442
447
443
### child_process.fork(modulePath[ , args] [ , options ] )
@@ -462,10 +458,10 @@ leaner than [`child_process.exec()`](#child_process_child_process_exec_command_o
462
458
* ` gid ` {Number} Sets the group identity of the process. (See setgid(2).)
463
459
* Return: ChildProcess object
464
460
465
- This is a special case of the [ ` child_process.spawn() ` ] ( #child_process_child_process_spawn_command_args_options ) functionality for spawning Node.js
466
- processes. In addition to having all the methods in a normal ChildProcess
467
- instance, the returned object has a communication channel built-in. See
468
- [ ` child.send(message, [sendHandle]) ` ] ( #child_process_child_send_message_sendhandle_callback ) for details.
461
+ This is a special case of the [ ` child_process.spawn() ` ] [ ] functionality for
462
+ spawning Node.js processes. In addition to having all the methods in a normal
463
+ ChildProcess instance, the returned object has a communication channel built-in.
464
+ See [ ` child.send(message, [sendHandle]) ` ] [ ] for details.
469
465
470
466
These child Node.js processes are still whole new instances of V8. Assume at
471
467
least 30ms startup and 10mb memory for each new Node.js. That is, you cannot
@@ -663,7 +659,7 @@ Example:
663
659
// startd-style interface.
664
660
spawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] });
665
661
666
- See also: [ ` child_process.exec() ` ] ( #child_process_child_process_exec_command_options_callback ) and [ ` child_process.fork() ` ] ( #child_process_child_process_fork_modulepath_args_options )
662
+ See also: [ ` child_process.exec() ` ] [ ] and [ ` child_process.fork() ` ] [ ]
667
663
668
664
## Synchronous Process Creation
669
665
@@ -703,11 +699,7 @@ process has exited.
703
699
704
700
If the process times out, or has a non-zero exit code, this method *** will***
705
701
throw. The ` Error ` object will contain the entire result from
706
- [ ` child_process.spawnSync() ` ] ( #child_process_child_process_spawnsync_command_args_options )
707
-
708
- [ EventEmitter ] : events.html#events_class_events_eventemitter
709
- [ net.Server ] : net.html#net_class_net_server
710
- [ net.Socket ] : net.html#net_class_net_socket
702
+ [ ` child_process.spawnSync() ` ] [ ]
711
703
712
704
### child_process.execSync(command[ , options] )
713
705
@@ -741,7 +733,7 @@ process has exited.
741
733
742
734
If the process times out, or has a non-zero exit code, this method *** will***
743
735
throw. The ` Error ` object will contain the entire result from
744
- [ ` child_process.spawnSync() ` ] ( #child_process_child_process_spawnsync_command_args_options )
736
+ [ ` child_process.spawnSync() ` ] [ ]
745
737
746
738
### child_process.spawnSync(command[ , args] [ , options ] )
747
739
@@ -774,3 +766,18 @@ timeout has been encountered and `killSignal` is sent, the method won't return
774
766
until the process has completely exited. That is to say, if the process handles
775
767
the ` SIGTERM ` signal and doesn't exit, your process will wait until the child
776
768
process has exited.
769
+
770
+ [ below ] : #child_process_asynchronous_process_creation
771
+ [ synchronous counterparts ] : #child_process_synchronous_process_creation
772
+ [ EventEmitter ] : events.html#events_class_events_eventemitter
773
+ [ `ChildProcess#kill()` ] : #child_process_child_kill_signal
774
+ [ `ChildProcess#send()` ] : #child_process_child_send_message_sendhandle_callback
775
+ [ net.Server ] : net.html#net_class_net_server
776
+ [ net.Socket ] : net.html#net_class_net_socket
777
+ [ `child_process.fork()` ] : #child_process_child_process_fork_modulepath_args_options
778
+ [ stdio ] : #child_process_options_stdio
779
+ [ spawn ] : #child_process_child_process_spawn_command_args_options
780
+ [ `child_process.exec()` ] : #child_process_child_process_exec_command_options_callback
781
+ [ `child_process.spawn()` ] : #child_process_child_process_spawn_command_args_options
782
+ [ ` child.send(message, [sendHandle]) ` ] : #child_process_child_send_message_sendhandle_callback
783
+ [ `child_process.spawnSync()` ] : #child_process_child_process_spawnsync_command_args_options
0 commit comments