1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

correct exec binary stdout to be consistent with spawn stdout.

Binary = buffer
String = utf8
This commit is contained in:
dceejay 2015-01-07 21:33:15 +00:00
parent 00429ebe70
commit 4fb2a44d74

View File

@ -67,7 +67,8 @@ module.exports = function(RED) {
var cl = node.cmd+" "+msg.payload+" "+node.append; var cl = node.cmd+" "+msg.payload+" "+node.append;
if (RED.settings.verbose) { node.log(cl); } if (RED.settings.verbose) { node.log(cl); }
var child = exec(cl, {encoding: 'binary'}, function (error, stdout, stderr) { var child = exec(cl, {encoding: 'binary'}, function (error, stdout, stderr) {
msg.payload = stdout; msg.payload = new Buffer(stdout);
if (isUtf8(msg.payload)) { msg.payload = msg.payload.toString(); }
var msg2 = {payload:stderr}; var msg2 = {payload:stderr};
var msg3 = null; var msg3 = null;
//console.log('[exec] stdout: ' + stdout); //console.log('[exec] stdout: ' + stdout);