snapdrop

A Progressive Web App for local file sharing
git clone http://git.hanabi.in/repos/snapdrop.git
Log | Files | Refs | README | LICENSE

commit f9bace9a16515b24979affcc5439de69b7dac339
parent 9c1fb153df68d79f441ed7072b019eddc3d69186
Author: Ying Kanyang (Harry Ying) <lexuge3yky@gmail.com>
Date:   Fri, 28 Aug 2020 22:07:25 +0800

Add support for SIGINT and SIGTERM handling

Currently, server run by `node index.js` is not able to handle SIGTERM or SIGINT properly. The only fate is being killed. This change adds basic handling logic for these two signals, helping server to behave more properly as expected by many daemons and users.
Diffstat:
Mserver/index.js | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/server/index.js b/server/index.js @@ -1,3 +1,16 @@ +var process = require('process') +// Handle SIGINT +process.on('SIGINT', () => { + console.info("SIGINT Received, exiting...") + process.exit(0) +}) + +// Handle SIGTERM +process.on('SIGTERM', () => { + console.info("SIGTERM Received, exiting...") + process.exit(0) +}) + const parser = require('ua-parser-js'); const { uniqueNamesGenerator, animals, colors } = require('unique-names-generator');