aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-stdio-closed.js
diff options
context:
space:
mode:
authorJohn Barboza <jbarboza@ca.ibm.com>2016-12-16 10:46:20 -0500
committerGibson Fahnestock <gib@uk.ibm.com>2017-01-23 19:59:20 +0000
commit106d09ab7a2d63816346cb46277b218f05bcce92 (patch)
tree38f320b6845ff8e27ec6609c681ec2b579a9db97 /test/parallel/test-stdio-closed.js
parent87039e307ed9dde762959da83bfd84cc3cf3e60e (diff)
downloadandroid-node-v8-106d09ab7a2d63816346cb46277b218f05bcce92.tar.gz
android-node-v8-106d09ab7a2d63816346cb46277b218f05bcce92.tar.bz2
android-node-v8-106d09ab7a2d63816346cb46277b218f05bcce92.zip
test: check fd 0,1,2 are used, not access mode
Don't do a write on stdout/stderr because that checks for their writability. But fd=1 could legitimately be opened with read-only access by the user. All this test needs to ensure is that they are used at startup. PR-URL: https://github.com/nodejs/node/pull/10339 Fixes: https://github.com/nodejs/node/issues/10234 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-stdio-closed.js')
-rw-r--r--test/parallel/test-stdio-closed.js19
1 files changed, 3 insertions, 16 deletions
diff --git a/test/parallel/test-stdio-closed.js b/test/parallel/test-stdio-closed.js
index a85467f76a..98e4f980d5 100644
--- a/test/parallel/test-stdio-closed.js
+++ b/test/parallel/test-stdio-closed.js
@@ -2,6 +2,7 @@
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
+const fs = require('fs');
if (common.isWindows) {
common.skip('platform not supported.');
@@ -9,21 +10,7 @@ if (common.isWindows) {
}
if (process.argv[2] === 'child') {
- 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);
- }
+ [0, 1, 2].forEach((i) => assert.doesNotThrow(() => fs.fstatSync(i)));
return;
}
@@ -32,5 +19,5 @@ 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.strictEqual(exitCode, common.isAix ? 126 : 42);
+ assert.strictEqual(exitCode, 0);
}));