Skip to content
Myr

Refactor execa promise to use `async/await` (#653)

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

authored by ehmicky · committed by GitHub · parent cff6847 · Browse files · 3 files+22 added−18 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+22 added−18 removed

  • tests:+11 added−3 removed
  • other:+11 added−15 removed

3 files+22 added−18 removed

modified:lib/promise.js+6 added-15 removed
modified:lib/stream.js+5 added
modified:test/test.js+11 added-3 removed
1import path from 'node:path';2import process from 'node:process';3import {setTimeout} from 'node:timers/promises';4import {fileURLToPath, pathToFileURL} from 'node:url';5import test from 'ava';6import isRunning from 'is-running';7import getNode from 'get-node';
116 unmodified lines
124125test.serial('execPath option', testExecPath, identity);126test.serial('execPath option can be a file URL', testExecPath, pathToFileURL);127127test('stdin errors are handled', async t => {128 const subprocess = execa('noop.js');128const emitStdinError = async subprocess => {129 await setTimeout(0);130 subprocess.stdin.emit('error', new Error('test'));130 await t.throwsAsync(subprocess, {message: /test/});131};132133test('stdin errors are handled', async t => {134 const subprocess = execa('forever.js');135 await Promise.all([136 t.throwsAsync(subprocess, {message: /test/}),137 emitStdinError(subprocess),138 ]);139});140141test('child process errors are handled', async t => {142 const subprocess = execa('noop.js');
171 unmodified lines