add try catch to helper shutdown,

tiny fixes for exec and trigger based on tests
This commit is contained in:
dceejay 2015-03-26 15:01:55 +00:00
parent cc1d080a5a
commit 16e17954b4
3 changed files with 17 additions and 14 deletions

View File

@ -22,9 +22,9 @@ module.exports = function(RED) {
function ExecNode(n) {
RED.nodes.createNode(this,n);
this.cmd = n.command.trim();
this.cmd = (n.command || "").trim();
this.addpay = n.addpay;
this.append = n.append.trim() || "";
this.append = (n.append || "").trim();
this.useSpawn = n.useSpawn;
var node = this;
@ -33,7 +33,7 @@ module.exports = function(RED) {
if (this.useSpawn === true) {
// make the extra args into an array
// 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 = [];
if (node.append.length > 0) { arg = node.append.split(","); }
if ((node.addpay === true) && (msg.payload.trim() !== "")) { arg.unshift(msg.payload); }

View File

@ -23,7 +23,7 @@ module.exports = function(RED) {
this.op2 = n.op2 || "0";
this.op1type = n.op1type || "val";
this.op2type = n.op2type || "val";
this.extend = n.extend || false;
this.extend = n.extend || "false";
this.units = n.units || "ms";
this.duration = n.duration || 250;
if (this.duration <= 0) { this.duration = 0; }

View File

@ -138,7 +138,11 @@ module.exports = {
//TODO consider saving TCP handshake/server reinit on start/stop/start sequences
stopServer: function(done) {
if(server) {
server.close(done);
try {
server.close(done);
} catch(e) {
done();
}
}
},
@ -148,4 +152,3 @@ module.exports = {
log: function() { return logSpy;}
};