0.1.0 • Published 9 years ago
execo v0.1.0
execo
thenable/yieldable child_process.exec with proper(really) logging, ideal for use in tools like gulp.
Usage
npm install execo
exec(cmd, mute)
execute command(s) with stdout logging optional:
// commands is executed serially
exec([
'mkdir -p build',
'cp client/foo build/bar'
])
.then(function () {
return exec('ls build') // terminal => 'bar'
})
.then(function () {
// mute stdout by passing truthy second argument
return exec('cat build/bar', true) // terminal => nothing
})
.then(function (bar) {
// promise resovled with stdout
return exec('echo ' + bar) // terminal => content of bar
})
.then(function () {
exec('rm -r build')
})
i hate execSync:
// simple deploy
co(function *() {
yield exec('gulp build')
yield exec('rsync -rptv --delete server user@host:project')
yield exec('ssh user@host "cd project; pm2 startOrRestart app.json"')
})
License
MIT
0.1.0
9 years ago