diff options
author | murgatroid99 <mlumish@google.com> | 2016-05-10 17:55:29 -0700 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2016-05-10 17:55:29 -0700 |
commit | 87f9e660f1e5ee85768e809aeee070e54f4e0b4c (patch) | |
tree | 3a65231913217d2757e1980968473e63816bd7ef /src/node | |
parent | 152883da4daf09976c5c46b4aa59f82c976d8844 (diff) |
Fix encoding and piping problems with Node plugin wrapper
Diffstat (limited to 'src/node')
-rwxr-xr-x | src/node/tools/bin/protoc.js | 5 | ||||
-rwxr-xr-x | src/node/tools/bin/protoc_plugin.js | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/node/tools/bin/protoc.js b/src/node/tools/bin/protoc.js index 4d50c94b0f..3bd1b84ffe 100755 --- a/src/node/tools/bin/protoc.js +++ b/src/node/tools/bin/protoc.js @@ -51,6 +51,7 @@ execFile(protoc, process.argv.slice(2), function(error, stdout, stderr) { if (error) { throw error; } - console.log(stdout); - console.log(stderr); }); + +child_process.stdout.pipe(process.stdout); +child_process.stderr.pipe(process.stderr); diff --git a/src/node/tools/bin/protoc_plugin.js b/src/node/tools/bin/protoc_plugin.js index 281ec0d85e..857882e1c3 100755 --- a/src/node/tools/bin/protoc_plugin.js +++ b/src/node/tools/bin/protoc_plugin.js @@ -47,10 +47,12 @@ var exe_ext = process.platform === 'win32' ? '.exe' : ''; var plugin = path.resolve(__dirname, 'grpc_node_plugin' + exe_ext); -execFile(plugin, process.argv.slice(2), function(error, stdout, stderr) { +var child_process = execFile(plugin, process.argv.slice(2), {encoding: 'buffer'}, function(error, stdout, stderr) { if (error) { throw error; } - console.log(stdout); - console.log(stderr); }); + +process.stdin.pipe(child_process.stdin); +child_process.stdout.pipe(process.stdout); +child_process.stderr.pipe(process.stderr); |