Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: accept expected AIX result test-stdio-closed #8755

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,5 @@ test-tick-processor-unknown : PASS,FLAKY
test-fs-watch-enoent : FAIL, PASS
test-fs-watch-encoding : FAIL, PASS

#being worked under https://github.com/nodejs/node/issues/7973
test-stdio-closed : PASS, FLAKY

#covered by https://github.com/nodejs/node/issues/8271
test-child-process-fork-dgram : PASS, FLAKY
30 changes: 20 additions & 10 deletions test/parallel/test-stdio-closed.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;

if (common.isWindows) {
common.skip('platform not supported.');
return;
}

if (process.argv[2] === 'child') {
process.stdout.write('stdout', function() {
process.stderr.write('stderr', function() {
process.exit(42);
try {
process.stdout.write('stdout', function() {
try {
process.stderr.write('stderr', function() {
process.exit(42);
});
} catch (e) {
process.exit(84);
}
});
});
} catch (e) {
assert.strictEqual(e.code, 'EBADF');
assert.strictEqual(e.message, 'EBADF: bad file descriptor, write');
process.exit(126);
}
return;
}

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

proc.on('exit', common.mustCall(function(exitCode) {
assert.equal(exitCode, 42);
assert.strictEqual(exitCode, common.isAix ? 126 : 42);
}));