diff options
author | cjihrig <cjihrig@gmail.com> | 2016-05-23 13:21:33 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2016-05-24 09:59:11 -0400 |
commit | dc76afffb6b7f3f4f263025808fcf809e95ddf91 (patch) | |
tree | 99ae8443dbf5105e5a3ef0805b78eacc6a45e04e /lib | |
parent | af61ebf6e261f479ed93ca3f3fd2f5cbaeb63b2f (diff) | |
download | android-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.js | 2 |
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; |