-
-
Save amoilanen/5853e57d3ead440314cee85fccaa3392 to your computer and use it in GitHub Desktop.
Node version of popen?
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; | |
var sh = spawn('sh'); | |
sh.stdout.on('data', function (data) { | |
console.log('sh: \n', data.toString()); | |
}); | |
sh.stderr.on('data', function (data) { | |
console.error('error: \n', data.toString()); | |
}); | |
console.log('ls'); | |
sh.stdin.write('ls\n'); | |
console.log('kill subprocess\n'); | |
sh.kill(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment