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

Lets spawn msg.payload contain comma separated parameters

(like rest of parameters passed in to spawn via edit dialogue)
Will also accept an array…
This commit is contained in:
Dave Conway-Jones 2015-10-04 19:22:28 +01:00
parent ddedea8b90
commit c1e8370916

View File

@ -35,9 +35,9 @@ module.exports = function(RED) {
// make the extra args into an array // make the extra args into an array
// then prepend with the msg.payload // then prepend with the msg.payload
if (typeof(msg.payload !== "string")) { msg.payload = (msg.payload || "").toString(); } if (typeof(msg.payload !== "string")) { msg.payload = (msg.payload || "").toString(); }
var arg = []; var pay = [];
if (node.append.length > 0) { arg = node.append.split(","); } if ((node.addpay === true) && (msg.payload.toString().trim() !== "")) { pay = msg.payload.split(","); }
if ((node.addpay === true) && (msg.payload.toString().trim() !== "")) { arg.unshift(msg.payload); } var arg = pay.concat(node.append.split(","));
if (RED.settings.verbose) { node.log(node.cmd+" ["+arg+"]"); } if (RED.settings.verbose) { node.log(node.cmd+" ["+arg+"]"); }
if (node.cmd.indexOf(" ") == -1) { if (node.cmd.indexOf(" ") == -1) {
var ex = spawn(node.cmd,arg); var ex = spawn(node.cmd,arg);