diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 8c3239909b255c..ce4432cfa053fd 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -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 diff --git a/test/parallel/test-stdio-closed.js b/test/parallel/test-stdio-closed.js index 0f94289ee96534..a85467f76a6d0f 100644 --- a/test/parallel/test-stdio-closed.js +++ b/test/parallel/test-stdio-closed.js @@ -1,7 +1,7 @@ '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.'); @@ -9,18 +9,28 @@ if (common.isWindows) { } 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); }));