diff --git a/packages/node_modules/@node-red/nodes/core/function/90-exec.js b/packages/node_modules/@node-red/nodes/core/function/90-exec.js index f5e7edd87..0df3e6012 100644 --- a/packages/node_modules/@node-red/nodes/core/function/90-exec.js +++ b/packages/node_modules/@node-red/nodes/core/function/90-exec.js @@ -18,6 +18,7 @@ module.exports = function(RED) { "use strict"; var spawn = require('child_process').spawn; var exec = require('child_process').exec; + var fs = require('fs'); var isUtf8 = require('is-utf8'); function ExecNode(n) { @@ -30,9 +31,12 @@ module.exports = function(RED) { this.timer = Number(n.timer || 0)*1000; this.activeProcesses = {}; this.oldrc = (n.oldrc || false).toString(); + this.execOpt = {encoding:'binary', maxBuffer:10000000}; var node = this; - var cleanup = function(p) { + if (process.platform === 'linux' && fs.existsSync('/bin/bash')) { node.execOpt.shell = '/bin/bash'; } + + var cleanup = function(p) { node.activeProcesses[p].kill(); //node.status({fill:"red",shape:"dot",text:"timeout"}); //node.error("Exec node timeout"); @@ -127,7 +131,7 @@ module.exports = function(RED) { if (node.append.trim() !== "") { cl += " "+node.append; } /* istanbul ignore else */ if (RED.settings.verbose) { node.log(cl); } - child = exec(cl, {encoding:'binary', maxBuffer:10000000}, function (error, stdout, stderr) { + child = exec(cl, node.execOpt, function (error, stdout, stderr) { var msg2, msg3; delete msg.payload; if (stderr) {