Skip to content

Commit

Permalink
Merge pull request #634 from webgme/worker_json_crash
Browse files Browse the repository at this point in the history
ExecutorWorker: dont crash on malformed executor_config.json
  • Loading branch information
lattmann committed Oct 17, 2015
2 parents 4cbc6c1 + 4270dc7 commit abd0b5b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/common/executor/ExecutorWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,17 @@ define([
errorCallback('Could not read ' + self.executorConfigFilename + ' err:' + err);
return;
}
var executorConfig = JSON.parse(data);
if (typeof executorConfig.cmd !== 'string' ||
var executorConfig;
try {
executorConfig = JSON.parse(data);
} catch (e) {
}
if (typeof executorConfig !== 'object' ||
typeof executorConfig.cmd !== 'string' ||
typeof executorConfig.resultArtifacts !== 'object') {

jobInfo.status = 'FAILED_EXECUTOR_CONFIG';
errorCallback(self.executorConfigFilename +
' is missing or wrong type for cmd and/or resultArtifacts.');
errorCallback(self.executorConfigFilename + ' is missing or wrong type for cmd and/or resultArtifacts.');
return;
}
var cmd = executorConfig.cmd;
Expand Down

0 comments on commit abd0b5b

Please sign in to comment.