Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

exeq

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exeq

Excute shell commands in queue

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

exeq

Excute shell commands in queue.

NPM version Build Status David Status NPM downloads


Install

$ npm install exeq --save

Usage

exeq()

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'
);

Kill the execution

var proc = exeq([
  'echo 1',
  'sleep 10',
  'echo 2'
]);
proc.q.kill();

Events

var proc = exeq([
  'echo 1',
  'echo 2'
]);

proc.q.on('stdour', function(data) {
  console.log(data);
});

proc.q.on('stderr', function(data) {
  console.log(data);
});

proc.q.on('killed', function(reason) {
  console.log(reason);
});

proc.q.on('done', function() {
});

proc.q.on('failed', function() {
});

Test

$ npm test

License

The MIT License (MIT)

Keywords

FAQs

Package last updated on 13 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc