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

Already on GitHub? Sign in to your account

Stopping server on error #27

Closed
DaftMonk opened this Issue Nov 30, 2013 · 6 comments

Comments

Projects
None yet
2 participants
Contributor

DaftMonk commented Nov 30, 2013

First of all, I want to thank you for the great work you've done on this grunt plugin.

I have livereload watching my server files. The problem is, if I introduce any error in the server code and save the file, the server reloads, throws an error, and then hangs. This is kind of annoying because then I have to close the command prompt out and CD back into the project folder to restart the server.

Is there a way to simply stop the server when an exception is thrown?

Owner

ericclemmons commented Dec 1, 2013

That's odd. I created this project because my server kept stopping whenever I introduced an error!

So, first, things first, can you post up your express portion of the grunt config? Second, are you exporting your server, as seen in server.js?

Contributor

DaftMonk commented Dec 1, 2013

Here's the express block

express: {
  options: {
    port: process.env.PORT || 9000
  },
  dev: {
    options: {
      script: 'server.js'
    }
  },
  prod: {
    options: {
      script: 'server.js',
      node_env: 'production'
    }
  }
},

I'm not exporting the server, is that important? I just tried exporting it a moment ago, then tried to introduce an error, and it still hung up.

Owner

ericclemmons commented Dec 1, 2013

Ah, I see now. I'm having the same problem. I'll resolve it

Owner

ericclemmons commented Dec 1, 2013

Oh, God. I'm an idiot. I was treating grunt.util.spawn's callback as an error function, but in fact, it's just a next() call.

Owner

ericclemmons commented Dec 1, 2013

v0.4.7 should resolve this!

Contributor

DaftMonk commented Dec 2, 2013

Awesome, that fixed it! Thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment