diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-01-06 02:12:26 +0100 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-01-10 11:35:45 -0800 |
commit | 627ecee9edd9df247e7541ee8084d925f85ede7f (patch) | |
tree | af56631aca2255d61fa90783f566ff3076aea6ea /test/parallel/test-child-process-spawnsync-input.js | |
parent | db14687dec5449c1e8b2abc4c4304d5767d4370f (diff) | |
download | android-node-v8-627ecee9edd9df247e7541ee8084d925f85ede7f.tar.gz android-node-v8-627ecee9edd9df247e7541ee8084d925f85ede7f.tar.bz2 android-node-v8-627ecee9edd9df247e7541ee8084d925f85ede7f.zip |
child_process: support Uint8Array input to methods
Support `Uint8Array` input to all the synchronous methods.
PR-URL: https://github.com/nodejs/node/pull/10653
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michal Zasso <targos@protonmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'test/parallel/test-child-process-spawnsync-input.js')
-rw-r--r-- | test/parallel/test-child-process-spawnsync-input.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/parallel/test-child-process-spawnsync-input.js b/test/parallel/test-child-process-spawnsync-input.js index fdd29aa7d0..8c0464facd 100644 --- a/test/parallel/test-child-process-spawnsync-input.js +++ b/test/parallel/test-child-process-spawnsync-input.js @@ -57,7 +57,7 @@ var options = { assert.throws(function() { spawnSync('cat', [], options); -}, /TypeError:.*should be Buffer or string not number/); +}, /TypeError:.*should be Buffer, Uint8Array or string not number/); options = { @@ -80,6 +80,16 @@ checkSpawnSyncRet(ret); assert.deepStrictEqual(ret.stdout, options.input); assert.deepStrictEqual(ret.stderr, Buffer.from('')); +options = { + input: Uint8Array.from(Buffer.from('hello world')) +}; + +ret = spawnSync('cat', [], options); + +checkSpawnSyncRet(ret); +assert.deepStrictEqual(ret.stdout, options.input); +assert.deepStrictEqual(ret.stderr, Buffer.from('')); + verifyBufOutput(spawnSync(process.execPath, args)); ret = spawnSync(process.execPath, args, { encoding: 'utf8' }); |