Skip to content

Commit e0b444e

Browse files
authored
Gracefully shut down the server on signals (#2246)
1 parent 4a32171 commit e0b444e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/react-scripts/scripts/start.js

+8
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ choosePort(HOST, DEFAULT_PORT)
8484
console.log(chalk.cyan('Starting the development server...\n'));
8585
openBrowser(urls.localUrlForBrowser);
8686
});
87+
88+
['SIGINT', 'SIGTERM'].forEach(function(sig) {
89+
process.on(sig, function() {
90+
console.log(`Gracefully shutting down server after ${sig}...`);
91+
server.close();
92+
process.exit();
93+
});
94+
});
8795
})
8896
.catch(err => {
8997
if (err && err.message) {

0 commit comments

Comments
 (0)