JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8827
  • Score
    100M100P100Q120948F
  • License MIT

Excute shell commands in queue

Package Exports

  • exeq

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (exeq) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

exeq

Excute shell commands in queue.

NPM version Build Status NPM downloads


Install

$ npm install exeq --save

Usage

exeq()

// cd command would change spawn cwd automatically
exeq(
  'mkdir example',
  'rm -rf example'
);

Promise 2.0.0+

// promise
exeq(
  'mkdir example',
  'cd example',
  'touch README.md',
  'touch somefile',
  'rm somefile',
  'ls -l',
  'cd ..',
  'rm -rf example',
  'ls -l > output.txt'
).then(function() {
  console.log('done!');
}).catch(function(err) {
  console.log(err);
});

Array

exeq([
  'mkdir example',
  'rm -rf example'
]);

stdout & stderr

exeq(
  'echo 123',
  'echo 456',
  'echo 789'
).then(function(results) {
  console.log(results[0].stdout); // '123'
  console.log(results[1].stdout); // '456'
  console.log(results[2].stdout); // '789'
});
exeq(
  'not-existed-command'
).then(function(results) {
}).catch(function(err) {
  console.log(err); // { code: '127', stderr: ' ... ' }
});

change cwd

// cd command would change spawn cwd automatically
// create README.md in example
exeq(
  'mkdir example',
  'cd example',
  'touch README.md'
);

Test

$ npm test

License

The MIT License (MIT)