Skip to content

Commit 2a3a190

Browse files
enaqxbrendanashworth
authored andcommitted
doc: add require() lines to child.stdio example
PR-URL: #1504 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent 2e2fce0 commit 2a3a190

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/api/child_process.markdown

+6-2
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,15 @@ In the following example, only the child's fd `1` is setup as a pipe, so only
144144
the parent's `child.stdio[1]` is a stream, all other values in the array are
145145
`null`.
146146

147-
child = child_process.spawn("ls", {
147+
var assert = require('assert');
148+
var fs = require('fs');
149+
var child_process = require('child_process');
150+
151+
child = child_process.spawn('ls', {
148152
stdio: [
149153
0, // use parents stdin for child
150154
'pipe', // pipe child's stdout to parent
151-
fs.openSync("err.out", "w") // direct child's stderr to a file
155+
fs.openSync('err.out', 'w') // direct child's stderr to a file
152156
]
153157
});
154158

0 commit comments

Comments
 (0)