Created
December 2, 2011 22:15
-
-
Save mmalecki/1425072 to your computer and use it in GitHub Desktop.
Close child's stdin
This file contains 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
console.log('Hello'); | |
var stdin = process.openStdin(); | |
stdin.on('data', function (d) { | |
console.log('Oh, I can exit now'); | |
stdin.pause(); | |
}); | |
process.on('exit', function () { | |
console.log('Oh, I am exitting now'); | |
}); | |
setTimeout(function () { | |
console.log('real exit'); | |
}, 1000); |
This file contains 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; | |
var c = spawn('node', ['child.js']); | |
c.stdin.destroy(); | |
c.stdout.pipe(process.stdout); | |
c.stderr.pipe(process.stderr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment