mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-03-02 11:21:14 +00:00
Added signal handler, to support stopping from a service manager, like procd
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -40,6 +40,9 @@ function start(path, parameters, options)
|
||||
var ret = { options: options, path: path, parameters: parameters };
|
||||
require('events').EventEmitter.call(ret, true)
|
||||
.createEvent('done');
|
||||
ret.sighandler = function sighandler() { process.exit(); };
|
||||
ret.sighandler.self = ret;
|
||||
if (process.platform != 'win32') { process.on('SIGTERM', ret.sighandler); }
|
||||
ret.child = require('child_process').execFile(path, parameters, ret.options);
|
||||
ret.child.parent = ret;
|
||||
ret.child.stdout.on('data', stdoutHandler);
|
||||
|
||||
Reference in New Issue
Block a user