@node-red/nodes 4.0.0-beta.2 → 4.0.0-beta.3-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -374,7 +374,7 @@ module.exports = function(RED) {
374
374
  iniOpt.breakOnSigint = true;
375
375
  }
376
376
  }
377
- node.script = vm.createScript(functionText, createVMOpt(node, ""));
377
+ node.script = new vm.Script(functionText, createVMOpt(node, ""));
378
378
  if (node.fin && (node.fin !== "")) {
379
379
  var finText = `(function () {
380
380
  var node = {
@@ -438,10 +438,9 @@ module.exports = function(RED) {
438
438
 
439
439
  //store the error in msg to be used in flows
440
440
  msg.error = err;
441
-
442
- var line = 0;
443
- var errorMessage;
444
441
  if (stack.length > 0) {
442
+ let line = 0;
443
+ let errorMessage;
445
444
  while (line < stack.length && stack[line].indexOf("ReferenceError") !== 0) {
446
445
  line++;
447
446
  }
@@ -455,11 +454,13 @@ module.exports = function(RED) {
455
454
  errorMessage += " (line "+lineno+", col "+cha+")";
456
455
  }
457
456
  }
457
+ if (errorMessage) {
458
+ err.message = errorMessage
459
+ }
458
460
  }
459
- if (!errorMessage) {
460
- errorMessage = err.toString();
461
- }
462
- done(errorMessage);
461
+ // Pass the whole error object so any additional properties
462
+ // (such as cause) are preserved
463
+ done(err);
463
464
  }
464
465
  else if (typeof err === "string") {
465
466
  done(err);
@@ -20,6 +20,7 @@ module.exports = function(RED) {
20
20
  var exec = require('child_process').exec;
21
21
  var fs = require('fs');
22
22
  var isUtf8 = require('is-utf8');
23
+ const isWindows = process.platform === 'win32'
23
24
 
24
25
  function ExecNode(n) {
25
26
  RED.nodes.createNode(this,n);
@@ -85,9 +86,12 @@ module.exports = function(RED) {
85
86
  }
86
87
  });
87
88
  var cmd = arg.shift();
89
+ // Since 18.20.2/20.12.2, it is invalid to call spawn on Windows with a .bat/.cmd file
90
+ // without using shell: true.
91
+ const opts = isWindows ? { ...node.spawnOpt, shell: true } : node.spawnOpt
88
92
  /* istanbul ignore else */
89
93
  node.debug(cmd+" ["+arg+"]");
90
- child = spawn(cmd,arg,node.spawnOpt);
94
+ child = spawn(cmd,arg,opts);
91
95
  node.status({fill:"blue",shape:"dot",text:"pid:"+child.pid});
92
96
  var unknownCommand = (child.pid === undefined);
93
97
  if (node.timer !== 0) {
@@ -103,7 +103,7 @@
103
103
  <h4>Automatic mode</h4>
104
104
  <p>Automatic mode uses the <code>parts</code> property of incoming messages to
105
105
  determine how the sequence should be joined. This allows it to automatically
106
- reverse the action of a <b>split</b> node.
106
+ reverse the action of a <b>split</b> node.</p>
107
107
 
108
108
  <h4>Manual mode</h4>
109
109
  <p>When configured to join in manual mode, the node is able to join sequences
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/nodes",
3
- "version": "4.0.0-beta.2",
3
+ "version": "4.0.0-beta.3-1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",