ensure daemon node has a command to run

in order to prevent crash.
This commit is contained in:
Dave Conway-Jones 2017-08-22 15:49:31 +01:00
parent 363bb55b26
commit 5ac15e620a
No known key found for this signature in database
GPG Key ID: 81B04231572A9A2D
2 changed files with 5 additions and 1 deletions

View File

@ -36,6 +36,10 @@ module.exports = function(RED) {
}
function runit() {
if (!node.cmd || (typeof node.cmd !== "string") || (node.cmd.length < 1)) {
node.status({fill:"grey",shape:"ring",text:"no command"});
return;
}
node.child = spawn(node.cmd, node.args);
if (RED.settings.verbose) { node.log(node.cmd+" "+JSON.stringify(node.args)); }
node.status({fill:"green",shape:"dot",text:"running"});

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-daemon",
"version" : "0.0.14",
"version" : "0.0.15",
"description" : "A Node-RED node that runs and monitors a long running system command.",
"dependencies" : {
},