summaryrefslogtreecommitdiff
path: root/test/known_issues/test-stdin-is-always-net.socket.js
diff options
context:
space:
mode:
authorJeremiah Senkpiel <fishrock123@rocketmail.com>2016-03-28 11:24:34 -0400
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2016-03-31 14:09:37 -0400
commitd6c9f64e98092bbca41209bb1babe22bee64be42 (patch)
tree2b5d6196503be997ea7bc440efdc07959a28eff8 /test/known_issues/test-stdin-is-always-net.socket.js
parent1845c4fdb79e5aca2466aa38bf76270f8a0f33d9 (diff)
downloadandroid-node-v8-d6c9f64e98092bbca41209bb1babe22bee64be42.tar.gz
android-node-v8-d6c9f64e98092bbca41209bb1babe22bee64be42.tar.bz2
android-node-v8-d6c9f64e98092bbca41209bb1babe22bee64be42.zip
test: stdin is not always a net.Socket
`<`-ing a file into stdin actually results in a `fs.ReadStream`, rather than a `tty.ReadStream`, and as such does not inherit from net.Socket, unlike the other possible stdin options. Refs: https://github.com/nodejs/node/pull/5916 PR-URL: https://github.com/nodejs/node/pull/5935 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/known_issues/test-stdin-is-always-net.socket.js')
-rw-r--r--test/known_issues/test-stdin-is-always-net.socket.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/known_issues/test-stdin-is-always-net.socket.js b/test/known_issues/test-stdin-is-always-net.socket.js
new file mode 100644
index 0000000000..a0c5c63198
--- /dev/null
+++ b/test/known_issues/test-stdin-is-always-net.socket.js
@@ -0,0 +1,19 @@
+'use strict';
+// Refs: https://github.com/nodejs/node/pull/5916
+
+const common = require('../common');
+const assert = require('assert');
+const spawn = require('child_process').spawn;
+const net = require('net');
+
+if (process.argv[2] === 'child') {
+ assert(process.stdin instanceof net.Socket);
+ return;
+}
+
+const proc = spawn(process.execPath, [__filename, 'child'], { stdio: 'ignore' });
+// To double-check this test, set stdio to 'pipe' and uncomment the line below.
+// proc.stderr.pipe(process.stderr);
+proc.on('exit', common.mustCall(function(exitCode) {
+ process.exitCode = exitCode;
+}));