mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Let exec node handle 0 as well as "0"
This commit is contained in:
parent
b6fcaacb77
commit
e50d04077b
@ -29,6 +29,7 @@ module.exports = function(RED) {
|
|||||||
this.useSpawn = n.useSpawn;
|
this.useSpawn = n.useSpawn;
|
||||||
this.timer = Number(n.timer || 0)*1000;
|
this.timer = Number(n.timer || 0)*1000;
|
||||||
this.activeProcesses = {};
|
this.activeProcesses = {};
|
||||||
|
var node = this;
|
||||||
|
|
||||||
var cleanup = function(p) {
|
var cleanup = function(p) {
|
||||||
//console.log("CLEANUP!!!",p);
|
//console.log("CLEANUP!!!",p);
|
||||||
@ -37,7 +38,6 @@ module.exports = function(RED) {
|
|||||||
node.error("Exec node timeout");
|
node.error("Exec node timeout");
|
||||||
}
|
}
|
||||||
|
|
||||||
var node = this;
|
|
||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
var child;
|
var child;
|
||||||
node.status({fill:"blue",shape:"dot",text:" "});
|
node.status({fill:"blue",shape:"dot",text:" "});
|
||||||
@ -45,8 +45,8 @@ 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
|
||||||
var arg = node.cmd;
|
var arg = node.cmd;
|
||||||
if (node.addpay) { arg += " "+msg.payload; }
|
if ((node.addpay === true) && msg.hasOwnProperty("payload")) { arg += " "+msg.payload; }
|
||||||
arg += " "+node.append;
|
if (node.append.trim() !== "") { arg += " "+node.append; }
|
||||||
// slice whole line by spaces (trying to honour quotes);
|
// slice whole line by spaces (trying to honour quotes);
|
||||||
arg = arg.match(/(?:[^\s"]+|"[^"]*")+/g);
|
arg = arg.match(/(?:[^\s"]+|"[^"]*")+/g);
|
||||||
var cmd = arg.shift();
|
var cmd = arg.shift();
|
||||||
@ -88,7 +88,7 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var cl = node.cmd;
|
var cl = node.cmd;
|
||||||
if ((node.addpay === true) && ((msg.payload || "").toString().trim() !== "")) { cl += " "+msg.payload; }
|
if ((node.addpay === true) && msg.hasOwnProperty("payload")) { cl += " "+msg.payload; }
|
||||||
if (node.append.trim() !== "") { cl += " "+node.append; }
|
if (node.append.trim() !== "") { cl += " "+node.append; }
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (RED.settings.verbose) { node.log(cl); }
|
if (RED.settings.verbose) { node.log(cl); }
|
||||||
|
Loading…
Reference in New Issue
Block a user