Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions test/return/early-error.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {arch} from 'node:os';
import process from 'node:process';
import test from 'ava';
import {execa, execaSync, $} from '../../index.js';
Expand Down Expand Up @@ -62,16 +63,18 @@ if (!isWindows) {
await t.throwsAsync(execa('non-executable.js', {input: 'Hey!'}), {message: /EACCES/});
});

test('write to fast-exit subprocess', async t => {
if (arch() === 'x64') {
test('write to fast-exit subprocess', async t => {
// Try-catch here is necessary, because this test is not 100% accurate
// Sometimes subprocess can manage to accept input before exiting
try {
await execa(`fast-exit-${process.platform}`, [], {input: 'data'});
t.pass();
} catch (error) {
t.is(error.code, 'EPIPE');
}
});
try {
await execa(`fast-exit-${process.platform}`, [], {input: 'data'});
t.pass();
} catch (error) {
t.is(error.code, 'EPIPE');
}
});
}
}

const testEarlyErrorPipe = async (t, getSubprocess) => {
Expand Down