Skip to content

Commit

Permalink
Gracefully shut down the server on signals (facebook#2246)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored and romaindso committed Jul 10, 2017
1 parent ac723c3 commit 47353da
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/react-scripts/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ choosePort(HOST, DEFAULT_PORT)
console.log(chalk.cyan('Starting the development server...\n'));
openBrowser(urls.localUrlForBrowser);
});

['SIGINT', 'SIGTERM'].forEach(function(sig) {
process.on(sig, function() {
console.log(`Gracefully shutting down server after ${sig}...`);
server.close();
process.exit();
});
});
})
.catch(err => {
if (err && err.message) {
Expand Down

0 comments on commit 47353da

Please sign in to comment.