0.0.1 • Published 8 years ago
@deployable/run v0.0.1
Run a process, store it's output, log things
const Promise = require('bluebird')
const {Run, RunRcError, RunError} = require('../run')
function genRunCmd(...cmd){
return function(){
return Run.fullLog(...cmd)
.catch(RunRcError, err => console.error('Bad rc %s', err.results.exit_code))
.catch(RunError, err => console.error('RunError: ', err))
.catch(err => console.error('Error: ', err ))
}
}
genRunCmd('ls')()
.then(genRunCmd('wc','-c','/etc/passwd'))
.then(genRunCmd('ls','-al'))
.then(genRunCmd('ls','whatever'))
.then(genRunCmd('lsa','broke'))
.then(genRunCmd('ls','sp ace', {ignore_rc:true}))
0.0.1
8 years ago