Third output from Exec node must be consistent for success/failure conditions

This commit is contained in:
Nick O'Leary
2017-03-02 13:34:01 +00:00
parent 54ee655472
commit d8720ee325
2 changed files with 117 additions and 46 deletions

View File

@@ -106,14 +106,16 @@ module.exports = function(RED) {
if(stderr) {
msg2 = {payload: stderr};
}
var msg3 = {payload:0};
var msg3 = null;
node.status({});
//console.log('[exec] stdout: ' + stdout);
//console.log('[exec] stderr: ' + stderr);
if (error !== null) {
msg3 = {payload:error.code};
msg3 = {payload:error};
node.status({fill:"red",shape:"dot",text:"error: "+error.code});
//console.log('[exec] error: ' + error);
} else {
msg3 = {payload: { code: 0 }}
}
node.send([msg,msg2,msg3]);
if (child.tout) { clearTimeout(child.tout); }