Skip to content

Commit 37ed05b

Browse files
committed
doc: copyedit child_process doc
PR-URL: #4188 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent e47ae58 commit 37ed05b

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

doc/api/child_process.markdown

+14-15
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ It is possible to stream data through a child's `stdin`, `stdout`, and
1010
line-buffered I/O internally. That doesn't affect Node.js but it means
1111
data you send to the child process may not be immediately consumed.)
1212

13-
To create a child process use `require('child_process').spawn()` or
13+
To create a child process, use `require('child_process').spawn()` or
1414
`require('child_process').fork()`. The semantics of each are slightly
15-
different, and explained [below][].
15+
different as explained [below][].
1616

1717
For scripting purposes you may find the [synchronous counterparts][] more
1818
convenient.
@@ -54,11 +54,11 @@ Emitted when:
5454

5555
1. The process could not be spawned, or
5656
2. The process could not be killed, or
57-
3. Sending a message to the child process failed for whatever reason.
57+
3. Sending a message to the child process failed.
5858

59-
Note that the `'exit'` event may or may not fire after an error has occurred. If
60-
you are listening on both events to fire a function, remember to guard against
61-
calling your function twice.
59+
Note that the `'exit'` event may or may not fire after an error has occurred.
60+
If you are listening on both events to fire a function, remember to guard
61+
against calling your function twice.
6262

6363
See also [`ChildProcess#kill()`][] and [`ChildProcess#send()`][].
6464

@@ -76,8 +76,7 @@ of the signal, otherwise `null`.
7676
Note that the child process stdio streams might still be open.
7777

7878
Also, note that Node.js establishes signal handlers for `SIGINT` and
79-
`SIGTERM`, so it will not terminate due to receipt of those signals,
80-
it will exit.
79+
`SIGTERM`. It will not terminate due to receipt of those signals. It will exit.
8180

8281
See `waitpid(2)`.
8382

@@ -103,8 +102,8 @@ gracefully once there are no other connections keeping it alive. After calling
103102
this method the `.connected` flag will be set to `false` in both the parent and
104103
child, and it is no longer possible to send messages.
105104

106-
The `'disconnect'` event will be emitted when there are no messages in the process
107-
of being received, most likely immediately.
105+
The `'disconnect'` event will be emitted when there are no messages in the
106+
process of being received, most likely immediately.
108107

109108
Note that you can also call `process.disconnect()` in the child process when the
110109
child process has any open IPC channels with the parent (i.e [`fork()`][]).
@@ -128,9 +127,9 @@ be sent `'SIGTERM'`. See `signal(7)` for a list of available signals.
128127

129128
May emit an `'error'` event when the signal cannot be delivered. Sending a
130129
signal to a child process that has already exited is not an error but may
131-
have unforeseen consequences: if the PID (the process ID) has been reassigned
132-
to another process, the signal will be delivered to that process instead.
133-
What happens next is anyone's guess.
130+
have unforeseen consequences. Specifically, if the process identifier (PID) has
131+
been reassigned to another process, the signal will be delivered to that
132+
process instead. What happens next is anyone's guess.
134133

135134
Note that while the function is called `kill`, the signal delivered to the
136135
child process may not actually kill it. `kill` really just sends a signal
@@ -142,7 +141,7 @@ See `kill(2)`
142141

143142
* {Integer}
144143

145-
The PID of the child process.
144+
The process identifier (PID) of the child process.
146145

147146
Example:
148147

@@ -183,7 +182,7 @@ And then the child script, `'sub.js'` might look like this:
183182

184183
process.send({ foo: 'bar' });
185184

186-
In the child the `process` object will have a `send()` method, and `process`
185+
In the child, the `process` object will have a `send()` method, and `process`
187186
will emit objects each time it receives a message on its channel.
188187

189188
There is a special case when sending a `{cmd: 'NODE_foo'}` message. All messages

0 commit comments

Comments
 (0)