mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
check for value type and convert anything that isn't a buffer or string
This commit is contained in:
parent
516faf25a0
commit
ad230c99b7
@ -150,6 +150,9 @@ module.exports = function(RED) {
|
|||||||
var value = RED.util.getMessageProperty(msg, node.addpay);
|
var value = RED.util.getMessageProperty(msg, node.addpay);
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
var stdinStream = new stream.Readable();
|
var stdinStream = new stream.Readable();
|
||||||
|
if (!Buffer.isBuffer(value) && (typeof value) !== 'string') {
|
||||||
|
value = JSON.stringify(value)
|
||||||
|
}
|
||||||
stdinStream.push(value); // Add data to the internal queue for users of the stream to consume
|
stdinStream.push(value); // Add data to the internal queue for users of the stream to consume
|
||||||
stdinStream.push(null); // Signals the end of the stream (EOF)
|
stdinStream.push(null); // Signals the end of the stream (EOF)
|
||||||
stdinStream.pipe(child.stdin);
|
stdinStream.pipe(child.stdin);
|
||||||
@ -204,6 +207,9 @@ module.exports = function(RED) {
|
|||||||
var value = RED.util.getMessageProperty(msg, node.addpay);
|
var value = RED.util.getMessageProperty(msg, node.addpay);
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
var stdinStream = new stream.Readable();
|
var stdinStream = new stream.Readable();
|
||||||
|
if (!Buffer.isBuffer(value) && (typeof value) !== 'string') {
|
||||||
|
value = JSON.stringify(value)
|
||||||
|
}
|
||||||
stdinStream.push(value); // Add data to the internal queue for users of the stream to consume
|
stdinStream.push(value); // Add data to the internal queue for users of the stream to consume
|
||||||
stdinStream.push(null); // Signals the end of the stream (EOF)
|
stdinStream.push(null); // Signals the end of the stream (EOF)
|
||||||
stdinStream.pipe(child.stdin);
|
stdinStream.pipe(child.stdin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user