diff --git a/packages/node_modules/@node-red/nodes/core/core/75-exec.js b/packages/node_modules/@node-red/nodes/core/core/75-exec.js index 09e54decc..a5132230e 100644 --- a/packages/node_modules/@node-red/nodes/core/core/75-exec.js +++ b/packages/node_modules/@node-red/nodes/core/core/75-exec.js @@ -38,7 +38,7 @@ module.exports = function(RED) { //node.error("Exec node timeout"); } - this.on("input", function(msg) { + this.on("input", function(msg, nodeSend, nodeDone) { if (msg.hasOwnProperty("kill")) { if (typeof msg.kill !== "string" || msg.kill.length === 0 || !msg.kill.toUpperCase().startsWith("SIG") ) { msg.kill = "SIGTERM"; } if (msg.hasOwnProperty("pid")) { @@ -53,6 +53,7 @@ module.exports = function(RED) { node.status({fill:"red",shape:"dot",text:"killed"}); } } + nodeDone(); } else { var child; @@ -85,14 +86,14 @@ module.exports = function(RED) { // console.log('[exec] stdout: ' + data,child.pid); if (isUtf8(data)) { msg.payload = data.toString(); } else { msg.payload = data; } - node.send([RED.util.cloneMessage(msg),null,null]); + nodeSend([RED.util.cloneMessage(msg),null,null]); } }); child.stderr.on('data', function (data) { if (node.activeProcesses.hasOwnProperty(child.pid) && node.activeProcesses[child.pid] !== null) { if (isUtf8(data)) { msg.payload = data.toString(); } else { msg.payload = Buffer.from(data); } - node.send([null,RED.util.cloneMessage(msg),null]); + nodeSend([null,RED.util.cloneMessage(msg),null]); } }); child.on('close', function (code,signal) { @@ -108,8 +109,9 @@ module.exports = function(RED) { if (code === null) { node.status({fill:"red",shape:"dot",text:"killed"}); } else if (code < 0) { node.status({fill:"red",shape:"dot",text:"rc:"+code}); } else { node.status({fill:"yellow",shape:"dot",text:"rc:"+code}); } - node.send([null,null,RED.util.cloneMessage(msg)]); + nodeSend([null,null,RED.util.cloneMessage(msg)]); } + nodeDone(); }); child.on('error', function (code) { if (child.tout) { clearTimeout(child.tout); } @@ -154,9 +156,10 @@ module.exports = function(RED) { msg.rc = msg3.payload; if (msg2) { msg2.rc = msg3.payload; } } - node.send([msg,msg2,msg3]); + nodeSend([msg,msg2,msg3]); if (child.tout) { clearTimeout(child.tout); } delete node.activeProcesses[child.pid]; + nodeDone(); }); node.status({fill:"blue",shape:"dot",text:"pid:"+child.pid}); child.on('error',function() {});