1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

Updated, so on INIT platforms when crash restart is specified, parameters can still be passed

This commit is contained in:
Bryan Roe
2019-07-19 11:16:54 -07:00
parent 5b7f892496
commit 804843eb32
2 changed files with 13 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1197,8 +1197,8 @@ function serviceManager()
if (options.failureRestart == null || options.failureRestart > 0) if (options.failureRestart == null || options.failureRestart > 0)
{ {
// Crash Restart is enabled, but it isn't inherently supported by INIT, so we must fake it with JS // Crash Restart is enabled, but it isn't inherently supported by INIT, so we must fake it with JS
var tmp_parameters = parameters; var tmp_parameters = parameters.split('"').join('\\"');
parameters = "-exec \\\"var child; process.on('SIGTERM', function () { child.removeAllListeners('exit'); child.kill(); process.exit(); }); function start() { child = require('child_process').execFile(process.execPath, ['sh']); child.stdout.on('data', function (c) { }); child.stderr.on('data', function (c) { }); child.on('exit', function (status) { start(); }); } start();\\\""; parameters = "-exec \\\"var child; process.on('SIGTERM', function () { child.removeAllListeners('exit'); child.kill(); process.exit(); }); function start() { child = require('child_process').execFile(process.execPath, [process.argv0, \\\"" + tmp_parameters + "\\\"]); child.stdout.on('data', function (c) { }); child.stderr.on('data', function (c) { }); child.on('exit', function (status) { start(); }); } start();\\\"";
} }
// The following is the init.d script I wrote. Rather than having to deal with escaping the thing, I just Base64 encoded it to prevent issues. // The following is the init.d script I wrote. Rather than having to deal with escaping the thing, I just Base64 encoded it to prevent issues.