1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

lets exec node pass more than just string as the command payload.

This commit is contained in:
Dave Conway-Jones 2015-07-08 15:06:08 +01:00
parent 1c33b837b8
commit 7de3704210

View File

@ -37,7 +37,7 @@ module.exports = function(RED) {
if (typeof(msg.payload !== "string")) { msg.payload = (msg.payload || "").toString(); }
var arg = [];
if (node.append.length > 0) { arg = node.append.split(","); }
if ((node.addpay === true) && (msg.payload.trim() !== "")) { arg.unshift(msg.payload); }
if ((node.addpay === true) && (msg.payload.toString().trim() !== "")) { arg.unshift(msg.payload); }
if (RED.settings.verbose) { node.log(node.cmd+" ["+arg+"]"); }
if (node.cmd.indexOf(" ") == -1) {
var ex = spawn(node.cmd,arg);
@ -67,7 +67,7 @@ module.exports = function(RED) {
}
else {
var cl = node.cmd;
if ((node.addpay === true) && ((msg.payload || "").trim() !== "")) { cl += " "+msg.payload; }
if ((node.addpay === true) && ((msg.payload.toString() || "").trim() !== "")) { cl += " "+msg.payload; }
if (node.append.trim() !== "") { cl += " "+node.append; }
if (RED.settings.verbose) { node.log(cl); }
var child = exec(cl, {encoding: 'binary', maxBuffer:10000000}, function (error, stdout, stderr) {