Created
March 13, 2014 18:01
-
-
Save siygle/9533495 to your computer and use it in GitHub Desktop.
spawnSync example
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 sync = require('child_process').spawnSync; | |
console.log('start ls'); | |
var ls = sync('ls', ['-lh', '/usr']); | |
console.log('end ls'); | |
console.log('start grep'); | |
var grep = sync('grep', ['local'], { | |
input: ls.stdout | |
}) | |
console.log('end grep'); | |
process.on('exit', function() { | |
console.log(grep.stdout.toString()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment