Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win,test: fix test-stdin-from-file #1067

Merged
merged 1 commit into from
Mar 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions test/fixtures/echo-close-check.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var common = require('../common');
var assert = require('assert');
var net = require('net');
var fs = require('fs');

process.stdout.write('hello world\r\n');

Expand All @@ -11,10 +12,8 @@ stdin.on('data', function(data) {
});

stdin.on('end', function() {
// If stdin's fd will be closed - createServer may get it
var server = net.createServer(function() {
}).listen(common.PORT, function() {
assert(typeof server._handle.fd !== 'number' || server._handle.fd > 2);
server.close();
});
// If stdin's fd was closed, the next open() call would return 0.
var fd = fs.openSync(process.argv[1], 'r');
assert(fd > 2);
fs.closeSync(fd);
});