Skip to content

Commit 157381c

Browse files
committed
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
1 parent 92c1d96 commit 157381c

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

test/parallel/parallel.status

-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,5 @@ test-tick-processor-unknown : PASS,FLAKY
3030
test-fs-watch-enoent : FAIL, PASS
3131
test-fs-watch-encoding : FAIL, PASS
3232

33-
#being worked under https://github.com/nodejs/node/issues/7973
34-
test-stdio-closed : PASS, FLAKY
35-
3633
#covered by https://github.com/nodejs/node/issues/8271
3734
test-child-process-fork-dgram : PASS, FLAKY

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)