summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2016-05-23 13:21:33 -0400
committercjihrig <cjihrig@gmail.com>2016-05-24 09:59:11 -0400
commitdc76afffb6b7f3f4f263025808fcf809e95ddf91 (patch)
tree99ae8443dbf5105e5a3ef0805b78eacc6a45e04e /lib
parentaf61ebf6e261f479ed93ca3f3fd2f5cbaeb63b2f (diff)
downloadandroid-node-v8-dc76afffb6b7f3f4f263025808fcf809e95ddf91.tar.gz
android-node-v8-dc76afffb6b7f3f4f263025808fcf809e95ddf91.tar.bz2
android-node-v8-dc76afffb6b7f3f4f263025808fcf809e95ddf91.zip
child_process: allow buffer encoding in spawnSync
When the 'buffer' encoding is passed to spawnSync(), an exception is thrown in Buffer's toString() method because 'buffer' is not a valid encoding there. This commit special cases the 'buffer' encoding. Fixes: https://github.com/nodejs/node/issues/6930 PR-URL: https://github.com/nodejs/node/pull/6939 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/child_process.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/child_process.js b/lib/child_process.js
index 2d2e23bbf1..0c6af12bc8 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -438,7 +438,7 @@ function spawnSync(/*file, args, options*/) {
var result = spawn_sync.spawn(options);
- if (result.output && options.encoding) {
+ if (result.output && options.encoding && options.encoding !== 'buffer') {
for (i = 0; i < result.output.length; i++) {
if (!result.output[i])
continue;