Skip to content

Commit

Permalink
Explicitely but gracefully handle SIGINT and SIGTERM signals.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucsky committed Feb 12, 2017
1 parent 0099613 commit 05fe53a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/webpack-dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ function startDevServer(wpOpt, options) {
throw e;
}

["SIGINT", "SIGTERM"].forEach(function(sig) {
process.on(sig, function() {
console.log(`Gracefully shutting down server after ${sig}...`);
server.close();
process.exit(); // eslint-disable-line no-process-exit
});
});

if(options.socket) {
server.listeningApp.on("error", function(e) {
if(e.code === "EADDRINUSE") {
Expand Down

0 comments on commit 05fe53a

Please sign in to comment.