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

Stopping server on error #27

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

Stopping server on error #27

DaftMonk opened this issue Nov 30, 2013 · 6 comments

Comments

@DaftMonk
Copy link
Contributor

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?

@ericclemmons
Copy link
Owner

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?

@DaftMonk
Copy link
Contributor Author

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.

@ericclemmons
Copy link
Owner

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

@ericclemmons
Copy link
Owner

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.

@ericclemmons
Copy link
Owner

v0.4.7 should resolve this!

@DaftMonk
Copy link
Contributor Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants