Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
test: fix test-net-listen-fd0 for pipes
Browse files Browse the repository at this point in the history
In the case of a pipe'd input, i.e. from the CI the fd will be a PIPE
and when listen() is called it will return ENOTSOCK instead of EINVAL.
  • Loading branch information
tjfontaine committed Jan 28, 2014
1 parent 76b9846 commit cd2d3ae
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/simple/test-net-listen-fd0.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ var net = require('net');
var gotError = false;

process.on('exit', function() {
assert.equal(gotError, true);
assert(gotError instanceof Error);
});

// this should fail with an async EINVAL error, not throw an exception
net.createServer(assert.fail).listen({fd:0}).on('error', function(e) {
assert.equal(e.code, 'EINVAL');
gotError = true;
switch(e.code) {
case 'EINVAL':
case 'ENOTSOCK':
gotError = e;
break
}
});

0 comments on commit cd2d3ae

Please sign in to comment.