@@ -130,8 +130,8 @@ exec('my.bat', (err, stdout, stderr) => {
130
130
* ` gid ` {Number} Sets the group identity of the process. (See setgid(2).)
131
131
* ` callback ` {Function} called with the output when process terminates
132
132
* ` error ` {Error}
133
- * ` stdout ` {Buffer}
134
- * ` stderr ` {Buffer}
133
+ * ` stdout ` {String| Buffer}
134
+ * ` stderr ` {String| Buffer}
135
135
* Return: {ChildProcess}
136
136
137
137
Spawns a shell then executes the ` command ` within that shell, buffering any
@@ -156,6 +156,13 @@ the exit code of the child process while `error.signal` will be set to the
156
156
signal that terminated the process. Any exit code other than ` 0 ` is considered
157
157
to be an error.
158
158
159
+ The ` stdout ` and ` stderr ` arguments passed to the callback will contain the
160
+ stdout and stderr output of the child process. By default, Node.js will decode
161
+ the output as UTF-8 and pass strings to the callback. The ` encoding ` option
162
+ can be used to specify the character encoding used to decode the stdout and
163
+ stderr output. If ` encoding ` is ` 'buffer' ` , ` Buffer ` objects will be passed to
164
+ the callback instead.
165
+
159
166
The ` options ` argument may be passed as the second argument to customize how
160
167
the process is spawned. The default options are:
161
168
@@ -197,8 +204,8 @@ replace the existing process and uses a shell to execute the command.*
197
204
* ` gid ` {Number} Sets the group identity of the process. (See setgid(2).)
198
205
* ` callback ` {Function} called with the output when process terminates
199
206
* ` error ` {Error}
200
- * ` stdout ` {Buffer}
201
- * ` stderr ` {Buffer}
207
+ * ` stdout ` {String| Buffer}
208
+ * ` stderr ` {String| Buffer}
202
209
* Return: {ChildProcess}
203
210
204
211
The ` child_process.execFile() ` function is similar to [ ` child_process.exec() ` ] [ ]
@@ -219,6 +226,13 @@ const child = execFile('node', ['--version'], (error, stdout, stderr) => {
219
226
});
220
227
```
221
228
229
+ The ` stdout ` and ` stderr ` arguments passed to the callback will contain the
230
+ stdout and stderr output of the child process. By default, Node.js will decode
231
+ the output as UTF-8 and pass strings to the callback. The ` encoding ` option
232
+ can be used to specify the character encoding used to decode the stdout and
233
+ stderr output. If ` encoding ` is ` 'buffer' ` , ` Buffer ` objects will be passed to
234
+ the callback instead.
235
+
222
236
### child_process.fork(modulePath[ , args] [ , options ] )
223
237
224
238
* ` modulePath ` {String} The module to run in the child
0 commit comments