blob: d5ed2e8d60f838166cbb4326629936f8bea86119 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
module.exports = (config, callback) => {
log.verbose("start command")
global.commandDone = false;
const exec = require('child_process').exec;
exec(config.command, (err, stdout, stderr) => {
if (err) {
log.warn("Command plugin error: " + err.toString());
global.commandReturnOutput = {
error: true,
errorMessage: err.toString(),
verbose: {
stdout: stdout,
stderr: stderr
}
}
global.commandDone = true;
callback();
} else {
log.info("Command plugin successfully terminated");
global.commandReturnOutput = {
error: false,
errorMessage: null,
verbose: {
stdout: stdout,
stderr: stderr
}
}
global.commandDone = true;
callback(commandReturnOutput);
}
});
}
|