Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch stopping once express restarts #32

Closed
gdw2 opened this issue Dec 17, 2013 · 9 comments
Closed

Watch stopping once express restarts #32

gdw2 opened this issue Dec 17, 2013 · 9 comments

Comments

@gdw2
Copy link

gdw2 commented Dec 17, 2013

Originally reported here:

gruntjs/grunt-contrib-watch#252

I'm experiencing a problem where, when a file changes, it reloads express but then watch stops! What can cause watch to stop?

OK
>> File "server/controllers/home.js" changed.

Running "express:dev" (express) task
[D] Task source: /home/gwarner/sl2_express/node_modules/grunt-express-server/tasks/express.js
Stopping Express server
Starting background Express server

Running "watch" task
[D] Task source: /home/gwarner/sl2_express/node_modules/grunt-contrib-watch/tasks/watch.js
Completed in 0.047s at Sun Dec 15 2013 05:26:23 GMT-0700 (MST) - Waiting...

Done, without errors.

Archlinux, Node v0.10.23

Gruntfile:

'use strict';

module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-express-server');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.initConfig({
        watch: {
            express: {
                files:  [ 'server/**/*.js' ],
                tasks:  [ 'express:dev' ],
                options: {
                    spawn: false // Without this option specified express won't be reloaded
                }
            }
        },
        express: {
            options: {
                // Override defaults here
            },
            dev: {
                options: {
                    script: 'server.js'
                }
            },
            prod: {
                options: {
                    script: 'server.js',
                    node_env: 'production'
                }
            },
            test: {
                options: {
                    script: 'server.js'
                }
            }
        }
    });

    grunt.registerTask('server', [ 'express:dev', 'watch' ])

};
@hamosapience
Copy link

encountered same problem

@Twipped
Copy link

Twipped commented Dec 19, 2013

+1 Also experiencing this

@brandonjp
Copy link

same here. versions 0.4.9 and before are fine.

@ericclemmons
Copy link
Owner

I may revert v0.4.10 then. @sebgie solved this in #31, but until the test suite for this project can exhibit the problem described in in #28 & #30 (which I & Travis have yet to be able to do), perhaps it's best to keep things predictable.

What do you think @hamosapience @ChiperSoft & @brandonjp? Reverting v0.4.10 & creating v0.4.11 seems fair?

@sebgie
Copy link
Contributor

sebgie commented Dec 19, 2013

@ericclemmons it is okay if you revert to the previous version. The problem is reproducible with my local environment and I'll try to come up with a travis test to demonstrate the problem. Sorry for causing another revert :-/.

@ericclemmons
Copy link
Owner

@sebgie No sweat man. I think we just need to figure out how to force the edge-case. It sounds like a race-condition, TBH, which makes it even worse to debug. (That's also why I introduced timeouts into tests a while ago, which isn't 100% fool-proof).

@ericclemmons
Copy link
Owner

Hey guys, try out v0.4.11 which I just pushed. It reverts v0.4.10, and I need to know if this solves the problem for you!

It also looks like I'll need to write tests using grunt-contrib-watch to ensure this doesn't come back up.

@brandonjp
Copy link

@ericclemmons Thanks for looking in to this. v0.4.11 is good for me.

@ericclemmons
Copy link
Owner

Good deal! I'm going to close this out to address the other issues in the repo.

Thanks @brandonjp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants