Skip to content

Commit

Permalink
Fix test on non-x64 machines (#1163)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored Oct 24, 2024
1 parent a4d13df commit 091ed74
Showing 1 changed file with 11 additions and 8 deletions.
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

0 comments on commit 091ed74

Please sign in to comment.