summaryrefslogtreecommitdiff
path: root/test/parallel/test-stdio-closed.js
diff options
context:
space:
mode:
authorBartosz Sosnowski <bartosz@janeasystems.com>2017-03-14 18:22:53 +0100
committerAnna Henningsen <anna@addaleax.net>2017-03-20 20:48:14 +0100
commitbd496e0187cebe5ae2d5ea2888487f041e6970fb (patch)
treeec0953523af84657d47b20c5271f37cd5caedb6c /test/parallel/test-stdio-closed.js
parent3622a97715858dc7e6aead57b605189c9cad0337 (diff)
downloadandroid-node-v8-bd496e0187cebe5ae2d5ea2888487f041e6970fb.tar.gz
android-node-v8-bd496e0187cebe5ae2d5ea2888487f041e6970fb.tar.bz2
android-node-v8-bd496e0187cebe5ae2d5ea2888487f041e6970fb.zip
src: ensure that fd 0-2 are valid on windows
Check that stdin, stdout and stderr are valid file descriptors on Windows. If not, reopen them with 'nul' file. Refs: https://github.com/nodejs/node/pull/875 Fixes: https://github.com/nodejs/node/issues/11656 PR-URL: https://github.com/nodejs/node/pull/11863 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/parallel/test-stdio-closed.js')
-rw-r--r--test/parallel/test-stdio-closed.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/parallel/test-stdio-closed.js b/test/parallel/test-stdio-closed.js
index 98e4f980d5..2313140a26 100644
--- a/test/parallel/test-stdio-closed.js
+++ b/test/parallel/test-stdio-closed.js
@@ -3,9 +3,21 @@ const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
const fs = require('fs');
+const path = require('path');
if (common.isWindows) {
- common.skip('platform not supported.');
+ if (process.argv[2] === 'child') {
+ process.stdin;
+ process.stdout;
+ process.stderr;
+ return;
+ }
+ const python = process.env.PYTHON || 'python';
+ const script = path.join(common.fixturesDir, 'spawn_closed_stdio.py');
+ const proc = spawn(python, [script, process.execPath, __filename, 'child']);
+ proc.on('exit', common.mustCall(function(exitCode) {
+ assert.strictEqual(exitCode, 0);
+ }));
return;
}