mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	add try catch to helper shutdown,
tiny fixes for exec and trigger based on tests
This commit is contained in:
		| @@ -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); } | ||||
|   | ||||
| @@ -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; } | ||||
|   | ||||
| @@ -138,7 +138,11 @@ module.exports = { | ||||
|     //TODO consider saving TCP handshake/server reinit on start/stop/start sequences | ||||
|     stopServer: function(done) { | ||||
|         if(server) { | ||||
|             try { | ||||
|                 server.close(done); | ||||
|             } catch(e) { | ||||
|                 done(); | ||||
|             } | ||||
|         } | ||||
|     }, | ||||
|  | ||||
| @@ -148,4 +152,3 @@ module.exports = { | ||||
|  | ||||
|     log: function() { return logSpy;} | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user