gruntjs - Is it possible to run a task after the watch task? -
i have php-based project won't run on grunt-php. instead, use grunt-exec run mamp server development.
exec: { serverup: { command: '/applications/mamp/bin/start.sh' }, serverdown: { command: '/applications/mamp/bin/stop.sh' } }
in custom development task, run mamp start script before watch task. then, i'm trying stop mamp server after i've exited watch task.
grunt.registertask('default', ['jshint', 'concat', 'compass:dev', 'exec:serverup', 'watch', 'exec:serverdown']);
however, if exit task ctrl-c, exec:serverdown
task never seems run. there way make work? since server never goes down, port tied until manually run stop script, , errors if try run default task again before bringing down.
if not, there other way accomplish same thing?
you listen on sigint
, run script:
var exec = require('child_process').exec; process.on('sigint', function () { exec('/applications/mamp/bin/stop.sh', function () { process.exit(); }); }); module.exports = function (grunt) {};
Comments
Post a Comment