Sandbox doesn't restart Interface.

This commit is contained in:
Atlante45 2017-06-29 13:22:11 -07:00
parent 5c731636b1
commit ec7fe81b87
2 changed files with 17 additions and 10 deletions

View file

@ -892,12 +892,18 @@ function onContentLoaded() {
deleteOldFiles(logPath, DELETE_LOG_FILES_OLDER_THAN_X_SECONDS, LOG_FILE_REGEX);
if (dsPath && acPath) {
domainServer = new Process('domain-server', dsPath, ['--get-temp-name',
'--parent-pid', process.pid], logPath);
acMonitor = new ACMonitorProcess('ac-monitor', acPath, ['-n7',
'--log-directory', logPath,
'--http-status-port', httpStatusPort,
'--parent-pid', process.pid], httpStatusPort, logPath);
var dsArguments = ['--get-temp-name',
'--parent-pid', process.pid];
domainServer = new Process('domain-server', dsPath, dsArguments,
logPath, true);
var acArguments = ['-n7',
'--log-directory', logPath,
'--http-status-port', httpStatusPort,
'--parent-pid', process.pid];
acMonitor = new ACMonitorProcess('ac-monitor', acPath, acArguments,
httpStatusPort, logPath, true);
homeServer = new ProcessGroup('home', [domainServer, acMonitor]);
logWindow = new LogWindow(acMonitor, domainServer);

View file

@ -102,7 +102,7 @@ ProcessGroup.prototype = extend(ProcessGroup.prototype, {
});
var ID = 0;
function Process(name, command, commandArgs, logDirectory) {
function Process(name, command, commandArgs, logDirectory, restartOnCrash) {
events.EventEmitter.call(this);
this.id = ++ID;
@ -113,6 +113,7 @@ function Process(name, command, commandArgs, logDirectory) {
this.logDirectory = logDirectory;
this.logStdout = null;
this.logStderr = null;
this.restartOnCrash = restartOnCrash;
this.state = ProcessStates.STOPPED;
};
@ -271,7 +272,7 @@ Process.prototype = extend(Process.prototype, {
var unexpectedShutdown = this.state != ProcessStates.STOPPING;
this.updateState(ProcessStates.STOPPED);
if (unexpectedShutdown) {
if (unexpectedShutdown && this.restartOnCrash) {
log.warn("Child stopped unexpectedly, restarting.");
this.start();
return;
@ -282,8 +283,8 @@ Process.prototype = extend(Process.prototype, {
// ACMonitorProcess is an extension of Process that keeps track of the AC Montior's
// children status and log locations.
const CHECK_AC_STATUS_INTERVAL = 1000;
function ACMonitorProcess(name, path, args, httpStatusPort, logPath) {
Process.call(this, name, path, args, logPath);
function ACMonitorProcess(name, path, args, httpStatusPort, logPath, restartOnCrash) {
Process.call(this, name, path, args, logPath, restartOnCrash);
this.httpStatusPort = httpStatusPort;