Created
April 24, 2012 23:39
-
-
Save piscisaureus/2484626 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spawn = require('child_process').spawn; | |
if (process.argv[2] !== 'child') { | |
/* Master process. */ | |
var cp = spawn(process.execPath, | |
[process.argv[1], 'child'], | |
{ customFds: [ -1, -1, 2 ] }); | |
cp.stdout.pause(); | |
} else { | |
var r, buffer; | |
buffer = new Buffer(1024); | |
buffer.fill(42); | |
do { | |
r = process.stdout.write(buffer); | |
console.error("Child: process.stdout.write returned", r); | |
} while (r); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment