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); deleteOldFiles(logPath, DELETE_LOG_FILES_OLDER_THAN_X_SECONDS, LOG_FILE_REGEX);
if (dsPath && acPath) { if (dsPath && acPath) {
domainServer = new Process('domain-server', dsPath, ['--get-temp-name', var dsArguments = ['--get-temp-name',
'--parent-pid', process.pid], logPath); '--parent-pid', process.pid];
acMonitor = new ACMonitorProcess('ac-monitor', acPath, ['-n7', domainServer = new Process('domain-server', dsPath, dsArguments,
'--log-directory', logPath, logPath, true);
'--http-status-port', httpStatusPort,
'--parent-pid', process.pid], httpStatusPort, logPath); 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]); homeServer = new ProcessGroup('home', [domainServer, acMonitor]);
logWindow = new LogWindow(acMonitor, domainServer); logWindow = new LogWindow(acMonitor, domainServer);

View file

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