Skip to content
Myr

Fix race condition with `subprocess.stdin.destroy()` (#904)

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

authored by ehmicky · committed by GitHub · parent d1889f6 · Browse files · 3 files+42 added−8 removed
This commit

State

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

Diff stats

3 files+42 added−8 removed

  • tests:+2 added−3 removed
  • other:+40 added−5 removed

3 files+42 added−8 removed

modified:lib/stream/resolve.js+1 added-1 removed
modified:lib/stream/wait.js+39 added-4 removed
modified:test/stdio/async.js+2 added-3 removed
17 unmodified lines
18 stdout: ['pipe', 'inherit', ...(isMultiple ? [1, process.stdout] : [])],19 stderr: ['pipe', 'inherit', ...(isMultiple ? [2, process.stderr] : [])],20});2122const onStdinRemoveListener = () => once(process.stdin, 'removeListener', {cleanup: true});22const onStdinRemoveListener = () => once(process.stdin, 'removeListener');2324const testListenersCleanup = async (t, isMultiple) => {25 const streamsPreviousListeners = getStandardStreamsListeners();26 const subprocess = execa('empty.js', getComplexStdio(isMultiple));27 t.notDeepEqual(getStandardStreamsListeners(), streamsPreviousListeners);28 await subprocess;29 await onStdinRemoveListener();28 await Promise.all([subprocess, onStdinRemoveListener()]);29 if (isMultiple) {30 await onStdinRemoveListener();31 }32
52 unmodified lines