Skip to content

Commit

Permalink
Return an error if execute stdin is not an object
Browse files Browse the repository at this point in the history
fixes #370
  • Loading branch information
Marta Gómez Macías committed Apr 16, 2019
1 parent e9dbce0 commit 26cf869
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions helpers/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ var disable_timeout = false;
exports.exec = function(cmd, args, stdin, callback) {
const child_process = require('child_process');

if (stdin != null)
stdin['ossec_path'] = config.ossec_path;
if (!stdin instanceof Object) {
err = "Error executing command: stdin value must be an object: " + stdin
logger.error("CMD - " + err);
error = true;
callback({"error": 1, "message": err});
}

stdin['ossec_path'] = config.ossec_path;

// log
stdin['arguments']['wait_for_complete'] = disable_timeout;
Expand Down

0 comments on commit 26cf869

Please sign in to comment.