gulp-nodemon
gulp-nodemon copied to clipboard
Need to hit CTRL-C twice to abort it when it has restarted before
Yeah, this is weird. When no file has changed, I can cancel gulp with once CTRL-C.
But when nodemon has restarted due to a file change, then I have to hit CTRL-C twice to cancel gulp.
Something does not look right here ...
Btw, this is my task:
gulp.task('run', ['default', 'watch'], function() {
var nodemon = require('gulp-nodemon'),
spawn = require('child_process').spawn,
bunyan
nodemon({
script: paths.server,
ext: 'js json',
ignore: [
'var/',
'node_modules/'
],
watch: [paths.etc, paths.src],
stdout: false,
readable: false
})
.on('change', ['lint'])
.on('readable', function() {
// free memory
bunyan && bunyan.kill()
bunyan = spawn('./node_modules/bunyan/bin/bunyan', [
'--output', 'short',
'--color'
])
bunyan.stdout.pipe(process.stdout)
bunyan.stderr.pipe(process.stderr)
this.stdout.pipe(bunyan.stdin)
this.stderr.pipe(bunyan.stdin)
});
})
Yes, I've noticed this.
It has something to do with how nodemon gets handled under the hood, and is fundamental to gulp-nodemon's success. I'm going to put this on hold till a few other bugs in nodemon come around. Thanks for the documentation of this though!
@binarykitchen I can no longer repro this; maybe it was fixed in a pull or with an update to nodemon? I'll leave this open for a bit so see if anyone is still seeing it.
I do have the same issue... That's weird.
Yeah I'm experiencing this as well. Using v2.0.4
@kweiberth can anyone give me steps to reproduce? It does't seem to happen on my system. This is the most pervasive issue with the project at the moment so it needs a test.
Hi Jackson, thanks for looking into this. I'm having to ctrl+c twice whenever I run my nodemon task.
The task:
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
path = require('path');
gulp.task('nodemon', function () {
nodemon({
script: path.join(__dirname, '../../src/server/index.js'),
ext: 'js',
args: ['--color'],
stdout: false
});
});
The server:
'use strict';
var express = require('express');
var app = express();
app.get('/', function(req, res) {
res.end('Hi');
});
app.listen(8080);
express: 4.13.3 gulp: 3.9.0 gulp-nodemon: 2.0.4 node: 4.0.0
Hopefully that helps!
I'm encountering this problem when running gulp serve from the command line for this project: https://github.com/kweiberth/reedio-react
I can confirm the PR above is working fine.
I'm also encountering this issue using same versions as @jakeorr described, additionally with node: 4.2.1.
Currently using the following as a workaround in my Gulpfile, based on jake's PR:
// inside Gulpfile.js
function exitHandler() { process.exit(0); }
process.once('SIGINT', exitHandler);
Im also having the same issue, @cgmartin workaround works for me
I can also confirm that @cgmartin workaround works to overcome this issue for me.
been looking high and low for this. Thanks @cgmartin!
//gulpfile.js
process.once('SIGINT', function(){
process.exit(0);
});
Same here, workaround still works.
@deterralba is this issue present in latest gulp-nodemon? workaround has been merged.
November 2016 and this issue with gulp-nodemon still hasn't been fixed. What I just found by accident is that when you give nodemon the tasks array parameter, not only does it run those tasks, but also reruns your gulpfile.js script with all of its tasks again. So if you modify a file 10 times, you would need to use Ctrl+C 10 times to terminate all gulp instances created by gulp-nodemon.