mirror of
https://github.com/zhigang1992/grunt-bg-shell.git
synced 2026-04-28 12:05:03 +08:00
ea600ac89baf1cd7d7f1cfa8897a2d37ff103aee
grunt-bg-shell
Better shell commands for grunt. Background/parallel run
If you want to run compass watch, coffee --watch --output lib/ src/ and forever server.js at the same time.
Install
$ npm i grunt-bg-shell --save-dev
Using
module.exports = function (grunt) {
grunt.initConfig({
bgShell: {
_defaults: {
bg: true
},
watchCompass: {
cmd: 'compass watch'
},
watchCoffee: {
cmd: 'coffee --watch --output lib/ src/'
},
runNode: {
cmd: 'node server.js',
bg: false
}
}
});
grunt.registerTask('default', 'bgShell:watchCompass bgShell:watchCoffee bgShell:runNode');
};
Important!
In example above all shell commands go to background. But not the last one.
We tell grunt to run till bgShell:runNode runs
Options
bgShell: {
lsTasks: {
cmd: 'ls -la',
execOpts: {
cwd: './tasks'
},
stdout: true,
stderr: true,
bg: false,
fail: false,
done: function(){}
}
}
cmd: command to executeexecOpts: options forchild_process.execstdout:true,falseorfunction(out){}stderr:true,falseorfunction(err){}bg: background executionfail: fail grunt on errordone: callback after executionfunction(err, stdout, stderr){}
Override defaults
bgShell: {
_defaults: {
execOpts: null,
stdout: true,
stderr: true,
bg: false,
fail: false,
done: function (err, stdout, stderr) {
}
},
}
Developing
You need to install grunt globally:
$ npm i -g grunt
- Watch coffee:
$ grunt
Description
Languages
CoffeeScript
100%