mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
add try catch to helper shutdown,
tiny fixes for exec and trigger based on tests
This commit is contained in:
parent
cc1d080a5a
commit
16e17954b4
@ -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; }
|
||||
|
@ -56,12 +56,12 @@ module.exports = {
|
||||
logSpy = sinon.spy(log,"log");
|
||||
logSpy.FATAL = log.FATAL;
|
||||
logSpy.ERROR = log.ERROR;
|
||||
logSpy.WARN = log.WARN;
|
||||
logSpy.INFO = log.INFO;
|
||||
logSpy.DEBUG = log.DEBUG;
|
||||
logSpy.TRACE = log.TRACE;
|
||||
logSpy.METRIC = log.METRIC;
|
||||
|
||||
logSpy.WARN = log.WARN;
|
||||
logSpy.INFO = log.INFO;
|
||||
logSpy.DEBUG = log.DEBUG;
|
||||
logSpy.TRACE = log.TRACE;
|
||||
logSpy.METRIC = log.METRIC;
|
||||
|
||||
if (typeof testCredentials === 'function') {
|
||||
cb = testCredentials;
|
||||
testCredentials = {};
|
||||
@ -94,7 +94,7 @@ module.exports = {
|
||||
testNode[i](RED);
|
||||
}
|
||||
} else {
|
||||
testNode(RED);
|
||||
testNode(RED);
|
||||
}
|
||||
flows.load().then(function() {
|
||||
should.deepEqual(testFlows, flows.getFlows());
|
||||
@ -138,14 +138,17 @@ 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();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
url: function() { return url; },
|
||||
|
||||
nock: nock,
|
||||
|
||||
|
||||
log: function() { return logSpy;}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user