1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-08 03:23:27 +00:00

1. Added SIGTERM even for linux/macos

2. Hooked up 'serviceStop' event for linux/macos
This commit is contained in:
Bryan Roe
2019-02-20 15:55:06 -08:00
parent 25b5f88bba
commit f6762fd724
2 changed files with 80 additions and 0 deletions

View File

@@ -170,6 +170,16 @@ function serviceHost(serviceName)
this.run = function run()
{
if (process.platform != 'win32')
{
var SIGTERM_Handler = function _SIGTERM_Handler()
{
_SIGTERM_Handler.parent.emit('serviceStop');
};
SIGTERM_Handler.parent = this;
process.on('SIGTERM', SIGTERM_Handler);
}
for(var i = 0; i<process.argv.length; ++i)
{
switch(process.argv[i])