Skip to content

Commit

Permalink
test: stdin is not always a net.Socket
Browse files Browse the repository at this point in the history
`<`-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: #5916
PR-URL: #5935
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
Fishrock123 authored and Myles Borins committed Apr 11, 2016
1 parent f60ce10 commit 63d8296
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/known_issues/test-stdin-is-always-net.socket.js
Original file line number Diff line number Diff line change
@@ -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;
}));

0 comments on commit 63d8296

Please sign in to comment.