Skip to content

Commit

Permalink
doc: add require() lines to child.stdio example
Browse files Browse the repository at this point in the history
PR-URL: #1504
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
  • Loading branch information
enaqx authored and brendanashworth committed May 2, 2015
1 parent 2e2fce0 commit 2a3a190
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/api/child_process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,15 @@ In the following example, only the child's fd `1` is setup as a pipe, so only
the parent's `child.stdio[1]` is a stream, all other values in the array are
`null`.

child = child_process.spawn("ls", {
var assert = require('assert');
var fs = require('fs');
var child_process = require('child_process');

child = child_process.spawn('ls', {
stdio: [
0, // use parents stdin for child
'pipe', // pipe child's stdout to parent
fs.openSync("err.out", "w") // direct child's stderr to a file
fs.openSync('err.out', 'w') // direct child's stderr to a file
]
});

Expand Down

0 comments on commit 2a3a190

Please sign in to comment.