From: Nick Raienko Date: Wed, 22 Apr 2015 11:58:04 +0000 (+0300) Subject: doc: add require() lines to child.stdio example X-Git-Tag: v2.0.0~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2a3a1909ab5c1d6ac3104327e148acfbc6b5eb24;p=platform%2Fupstream%2Fnodejs.git doc: add require() lines to child.stdio example PR-URL: https://github.com/iojs/io.js/pull/1504 Reviewed-By: Colin Ihrig Reviewed-By: Roman Reiss --- diff --git a/doc/api/child_process.markdown b/doc/api/child_process.markdown index 3156705..19b2b90 100644 --- a/doc/api/child_process.markdown +++ b/doc/api/child_process.markdown @@ -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 ] });