mirror of https://github.com/nodejs/node.git
test: fix test-net-listen-fd0 for pipes
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.archived-io.js-v0.10
parent
76b98462e5
commit
cd2d3aedaa
|
@ -26,11 +26,15 @@ var net = require('net');
|
||||||
var gotError = false;
|
var gotError = false;
|
||||||
|
|
||||||
process.on('exit', function() {
|
process.on('exit', function() {
|
||||||
assert.equal(gotError, true);
|
assert(gotError instanceof Error);
|
||||||
});
|
});
|
||||||
|
|
||||||
// this should fail with an async EINVAL error, not throw an exception
|
// this should fail with an async EINVAL error, not throw an exception
|
||||||
net.createServer(assert.fail).listen({fd:0}).on('error', function(e) {
|
net.createServer(assert.fail).listen({fd:0}).on('error', function(e) {
|
||||||
assert.equal(e.code, 'EINVAL');
|
switch(e.code) {
|
||||||
gotError = true;
|
case 'EINVAL':
|
||||||
|
case 'ENOTSOCK':
|
||||||
|
gotError = e;
|
||||||
|
break
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue