Skip to content
Myr

Allow streams to end before the other stream piping to them (#821)

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

authored by ehmicky · committed by GitHub · parent 268ad95 · Browse files · 2 files+19 added−26 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+19 added−26 removed

  • tests:+6 added−1 removed
  • other:+13 added−25 removed

2 files+19 added−26 removed

modified:lib/stdio/pipeline.js+13 added-25 removed
modified:test/stdio/node-stream.js+6 added-1 removed
191 unmodified lines
192193test('Handles output streams ends', async t => {194 const stream = noopWritable();195 const childProcess = execa('stdin.js', {stdout: [stream, 'pipe']});196 stream.end();196 childProcess.stdin.end();197 await setImmediate();198 stream.destroy();199200 const error = await t.throwsAsync(childProcess, {code: 'ERR_STREAM_PREMATURE_CLOSE'});201 assertStreamError(t, error);202});203
24 unmodified lines
228229const testChildStreamEnd = async (t, stream) => {230 const childProcess = execa('stdin.js', {stdin: [stream, 'pipe']});231 childProcess.stdin.end();232 await setImmediate();233 stream.destroy();234235 const error = await t.throwsAsync(childProcess, {code: 'ERR_STREAM_PREMATURE_CLOSE'});236 assertStreamError(t, error);237 t.true(stream.destroyed);238};
30 unmodified lines