lego-exeq
v0.0.4
Published
Execute shell commands synchronously.
Downloads
20
Maintainers
Readme
exeq
Excute shell commands synchronously.
Install
$ npm install lego-exeq --save
Usage
exeq(array)
var exeq = require('lego-exeq');
// cd command would change spawn cwd automatically
exeq([
'mkdir example',
'cd example',
'touch README.md'
]);
// each & done events
exeq([
'mkdir example',
'cd example',
'touch README.md',
'touch somefile',
'rm somefile',
'ls -l',
'cd ..',
'rm -rf example',
'ls -l > output.txt'
]).on('each', function(command, index) {
// After each command executed
console.log('No.' + index + ' Executed: ' + command);
console.log();
}).on('done', function(count) {
console.log('---');
console.log(count + ' commands done!');
});
Do not support command string with
&&
.
Test
$ npm test
License
The MIT License (MIT)