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:
parent
1c33b837b8
commit
7de3704210
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user