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