example.js 426 B

1234567891011121314151617
  1. var execSh = require('../')
  2. // run interactive bash shell
  3. execSh('echo ola && bash', { cwd: '/home' }, function (err) {
  4. if (err) {
  5. console.log('Exit code: ', err.code)
  6. return
  7. }
  8. // collect streams output
  9. execSh(['bash -c id', 'echo olaola >&2'], true,
  10. function (err, stdout, stderr) {
  11. console.log('error: ', err)
  12. console.log('stdout: ', stdout)
  13. console.log('stderr: ', stderr)
  14. })
  15. })