• Stars
    star
    103
  • Rank 333,046 (Top 7 %)
  • Language
    JavaScript
  • License
    Other
  • Created almost 11 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🔀 Excute shell commands in queue

exeq

Execute 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('stdout', 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)

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay

More Repositories

1

fanyi

A 🇨🇳 and 🇺🇸 translate tool in your command line.
JavaScript
1,315
star
2

surge-preview

🔂 Preview website in surge.sh for every pull request.
TypeScript
143
star
3

sketch-awesome-plugins

🎨 一套不错的 Sketch3 插件合集。
Shell
73
star
4

afc163

55
star
5

array-tree-filter

filter in array tree
JavaScript
54
star
6

MiniblogImgPop

🗻 微博浮图控件
JavaScript
37
star
7

cmdize

Convert normal js to CMD module
JavaScript
36
star
8

npm-clean

Clean unused dependenices in package.json
JavaScript
22
star
9

confirm-cli

A confirm interface in command line
JavaScript
19
star
10

wa

A super convenience watch and upload tool.
JavaScript
19
star
11

color3d

Display color spaces with three.js
JavaScript
18
star
12

cdn

Upload your files to cdn
JavaScript
16
star
13

grunt-peaches

The Grunt task for peaches.
JavaScript
10
star
14

homebrew

10
star
15

dva-logger

redux-logger plugin for dva.
JavaScript
10
star
16

word-color

Color your words!
JavaScript
9
star
17

es-dev-server-react

JavaScript
8
star
18

dora-plugin-upload

dora plugin for mocking file upload
JavaScript
8
star
19

chrome

Open chrome in shell
JavaScript
7
star
20

afc163.github.io

blog
HTML
6
star
21

dotfiles

Shell
5
star
22

Cold

兴趣导向的私人的研究性质的前端JS框架。
JavaScript
5
star
23

snakeGame

How time flies!
JavaScript
3
star
24

ued.alipay.com

alipay ued site.
JavaScript
3
star
25

svn-sync

Get svn info object synchronously.
JavaScript
2
star
26

react-dapp

JavaScript
2
star
27

myapp

react 测试 demo 工程
JavaScript
2
star
28

github-action-test

JavaScript
2
star
29

whoami

Who am I
JavaScript
2
star
30

now

spm package example
JavaScript
2
star
31

elasticsearch-package

Package same as:
Shell
2
star
32

cloudflare-worker-demo

JavaScript
1
star
33

ant-react-form-list

JavaScript
1
star
34

husky-test

1
star
35

monster

JavaScript
1
star
36

antd-pro-aliyun-theme

JavaScript
1
star