Skip to content

Commit dc94b29

Browse files
committed
Handle SIGTERM correctly
Issue mendhak#4
1 parent aee8b6c commit dc94b29

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ process.on('exit', function () {
7272
});
7373
});
7474

75-
process.on('SIGINT', function() {
76-
console.log('Got SIGINT. Trying to exit gracefully.');
75+
process.on('SIGINT', shutDown);
76+
process.on('SIGTERM', shutDown);
77+
78+
function shutDown(){
79+
console.log('Got a kill signal. Trying to exit gracefully.');
7780
calledClose = true;
7881
httpServer.close(function() {
7982
httpsServer.close(function() {
@@ -82,4 +85,4 @@ process.on('SIGINT', function() {
8285
});
8386

8487
});
85-
});
88+
}

0 commit comments

Comments
 (0)