Skip to content

Instantly share code, notes, and snippets.

@siygle
Created March 13, 2014 18:01
Show Gist options
  • Save siygle/9533495 to your computer and use it in GitHub Desktop.
Save siygle/9533495 to your computer and use it in GitHub Desktop.
spawnSync example
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