Skip to content
Myr

Do not buffer when streams are used - fixes #84 (#95)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sam Verschueren · committed by Sindre Sorhus · parent afa9700 · Browse files · 2 files+9 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−3 removed

  • other:+9 added−3 removed

2 files+9 added−3 removed

modified:index.js+3 added-3 removed
198 unmodified lines
199 spawned.stderr.destroy();200 }201 }202203 const promise = pFinally(Promise.all([203 const handlePromise = () => pFinally(Promise.all([204 processDone,205 getStream(spawned, 'stdout', encoding, maxBuffer),206 getStream(spawned, 'stderr', encoding, maxBuffer)207 ]).then(arr => {
63 unmodified lines
271 crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);272273 handleInput(spawned, parsed.opts);274275 spawned.then = promise.then.bind(promise);276 spawned.catch = promise.catch.bind(promise);275 spawned.then = (onfulfilled, onrejected) => handlePromise().then(onfulfilled, onrejected);276 spawned.catch = onrejected => handlePromise().catch(onrejected);277278 return spawned;279};280
34 unmodified lines
modified:test.js+6 added
455 unmodified lines
456 'undefined',457 'bar'458 ]);459});460461test('do not buffer when streaming', async t => {462 const result = await getStream(m('max-buffer', ['stdout', '21'], {maxBuffer: 10}).stdout);463464 t.is(result, '....................\n');465});