@node-red/util 4.1.0-beta.2 → 4.1.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.
- package/lib/exec.js +9 -1
- package/lib/util.js +23 -4
- package/package.json +1 -1
package/lib/exec.js
CHANGED
|
@@ -57,7 +57,15 @@ module.exports = {
|
|
|
57
57
|
return new Promise((resolve, reject) => {
|
|
58
58
|
let stdout = "";
|
|
59
59
|
let stderr = "";
|
|
60
|
-
|
|
60
|
+
let child
|
|
61
|
+
if (args && options.shell) {
|
|
62
|
+
// If we are using a shell, we need to join the args into a single string
|
|
63
|
+
// as passing a separate array of args is deprecated in Node 24
|
|
64
|
+
command = [command].concat(args).join(" ");
|
|
65
|
+
child = child_process.spawn(command, options)
|
|
66
|
+
} else {
|
|
67
|
+
child = child_process.spawn(command, args, options);
|
|
68
|
+
}
|
|
61
69
|
child.stdout.on('data', (data) => {
|
|
62
70
|
const str = ""+data;
|
|
63
71
|
stdout += str;
|
package/lib/util.js
CHANGED
|
@@ -877,14 +877,16 @@ function encodeObject(msg,opts) {
|
|
|
877
877
|
});
|
|
878
878
|
} else {
|
|
879
879
|
var isArray = Array.isArray(msg.msg);
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
880
|
+
const isTypedArray = ArrayBuffer.isView(msg.msg);
|
|
881
|
+
var needsStringify = isArray || isTypedArray;
|
|
882
|
+
var typeName = isArray ? 'array' : constructorName(msg.msg);
|
|
883
|
+
if (isArray || isTypedArray) {
|
|
884
|
+
msg.format = typeName + "["+msg.msg.length+"]";
|
|
883
885
|
if (msg.msg.length > debuglength) {
|
|
884
886
|
// msg.msg = msg.msg.slice(0,debuglength);
|
|
885
887
|
msg.msg = {
|
|
886
888
|
__enc__: true,
|
|
887
|
-
type:
|
|
889
|
+
type: typeName,
|
|
888
890
|
data: msg.msg.slice(0,debuglength),
|
|
889
891
|
length: msg.msg.length
|
|
890
892
|
}
|
|
@@ -948,6 +950,16 @@ function encodeObject(msg,opts) {
|
|
|
948
950
|
data: value.slice(0,debuglength),
|
|
949
951
|
length: value.length
|
|
950
952
|
}
|
|
953
|
+
} else if (ArrayBuffer.isView(value) && value.length > debuglength && !Buffer.isBuffer(value)) { // include typed arrays, exclude Buffer
|
|
954
|
+
// Note: Buffer is a subclass of Uint8Array
|
|
955
|
+
const typeName = constructorName(value);
|
|
956
|
+
/** @type {ArrayBufferView} */
|
|
957
|
+
value = {
|
|
958
|
+
__enc__: true,
|
|
959
|
+
type: typeName,
|
|
960
|
+
data: Array.from(value).slice(0,debuglength),
|
|
961
|
+
length: value.length
|
|
962
|
+
}
|
|
951
963
|
} else if (typeof value === 'string') {
|
|
952
964
|
if (value.length > debuglength) {
|
|
953
965
|
value = value.substring(0,debuglength)+"...";
|
|
@@ -978,6 +990,13 @@ function encodeObject(msg,opts) {
|
|
|
978
990
|
if (value.length > debuglength) {
|
|
979
991
|
value.data = value.data.slice(0,debuglength);
|
|
980
992
|
}
|
|
993
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
994
|
+
value = {
|
|
995
|
+
__enc__: true,
|
|
996
|
+
type: "array",
|
|
997
|
+
data: Array.from(value),
|
|
998
|
+
length: value.length
|
|
999
|
+
}
|
|
981
1000
|
} else if (constructorName(value) === "ServerResponse") {
|
|
982
1001
|
value = "[internal]"
|
|
983
1002
|
} else if (constructorName(value) === "Socket") {
|