Skip to content
Myr

Improve performance of `childProcess.all` when `stdout` or `stderr` is `ignore` (#646)

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

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

  • tests:+9 added−8 removed
  • other:+10 added−2 removed

2 files+19 added−10 removed

modified:lib/stream.js+10 added-2 removed
modified:test/stream.js+9 added-8 removed
68 unmodified lines
69 const {all} = await execa('noop.js', {stdio: 'ignore', all: true});70 t.is(all, undefined);71});7273const testAllIgnore = async (t, streamName, otherStreamName) => {74 const childProcess = execa('noop.js', {[otherStreamName]: 'ignore', all: true});75 t.is(childProcess.all, childProcess[streamName]);76 await childProcess;77};7879test('can use all: true with stdout: ignore', testAllIgnore, 'stderr', 'stdout');80test('can use all: true with stderr: ignore', testAllIgnore, 'stdout', 'stderr');8182const testIgnore = async (t, streamName, execaMethod) => {83 const result = await execaMethod('noop.js', {[streamName]: 'ignore'});84 t.is(result[streamName], undefined);85};
67 unmodified lines
153 const subprocess = execa('wrong command', {buffer: false, reject: false});154 await t.notThrowsAsync(Promise.all([subprocess, pEvent(subprocess.stdout, 'end')]));155});156148test('can use all: true with stdout: ignore', async t => {149 await t.notThrowsAsync(execa('max-buffer.js', {buffer: false, stdout: 'ignore', all: true}));150});151152test('can use all: true with stderr: ignore', async t => {153 await t.notThrowsAsync(execa('max-buffer.js', ['stderr'], {buffer: false, stderr: 'ignore', all: true}));154});155157const BUFFER_TIMEOUT = 1e3;158159// On Unix (not Windows), a process won't exit if stdout has not been read.160if (process.platform !== 'win32') {
50 unmodified lines