Skip to content

Commit b64828d

Browse files
TrottMylesBorins
authored andcommitted
test: accept expected AIX result test-stdio-closed
AIX handles closed stdio differently (but still compliant with spec as far as I can tell) than other POSIX variants we test. Test results are different than Linux and others because AIX takes measures to not re-use the file descriptors for stdio if one of the stdio streams is closed. Fixes: #8375 PR-URL: #8755 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Ilkka Myller <[email protected]>
1 parent 3dbcc3d commit b64828d

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

test/parallel/parallel.status

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ test-fs-watch-enoent : FAIL, PASS
3434
# Disable so we don't get failures now that AIX has been
3535
# added to regular CI runs
3636
test-regress-GH-1899 : FAIL, PASS
37-
test-stdio-closed : FAIL, PASS
3837

3938
# Flaky until https://github.com/nodejs/build/issues/415 is resolved.
4039
# On some of the buildbots, AAAA queries for localhost don't resolve

test/parallel/test-stdio-closed.js

+20-10
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
4-
var spawn = require('child_process').spawn;
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const spawn = require('child_process').spawn;
55

66
if (common.isWindows) {
77
common.skip('platform not supported.');
88
return;
99
}
1010

1111
if (process.argv[2] === 'child') {
12-
process.stdout.write('stdout', function() {
13-
process.stderr.write('stderr', function() {
14-
process.exit(42);
12+
try {
13+
process.stdout.write('stdout', function() {
14+
try {
15+
process.stderr.write('stderr', function() {
16+
process.exit(42);
17+
});
18+
} catch (e) {
19+
process.exit(84);
20+
}
1521
});
16-
});
22+
} catch (e) {
23+
assert.strictEqual(e.code, 'EBADF');
24+
assert.strictEqual(e.message, 'EBADF: bad file descriptor, write');
25+
process.exit(126);
26+
}
1727
return;
1828
}
1929

2030
// Run the script in a shell but close stdout and stderr.
21-
var cmd = `"${process.execPath}" "${__filename}" child 1>&- 2>&-`;
22-
var proc = spawn('/bin/sh', ['-c', cmd], { stdio: 'inherit' });
31+
const cmd = `"${process.execPath}" "${__filename}" child 1>&- 2>&-`;
32+
const proc = spawn('/bin/sh', ['-c', cmd], { stdio: 'inherit' });
2333

2434
proc.on('exit', common.mustCall(function(exitCode) {
25-
assert.equal(exitCode, 42);
35+
assert.strictEqual(exitCode, common.isAix ? 126 : 42);
2636
}));

0 commit comments

Comments
 (0)