We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fce10f7 commit 5668403Copy full SHA for 5668403
test/parallel/test-listen-fd-ebadf.js
@@ -1,11 +1,23 @@
1
'use strict';
2
const common = require('../common');
3
+
4
const assert = require('assert');
5
+const fs = require('fs');
6
const net = require('net');
7
8
net.createServer(common.mustNotCall()).listen({fd: 2})
9
.on('error', common.mustCall(onError));
-net.createServer(common.mustNotCall()).listen({fd: 42})
10
11
+let invalidFd = 2;
12
13
+// Get first known bad file descriptor.
14
+try {
15
+ while (fs.fstatSync(++invalidFd));
16
+} catch (e) {
17
+ // do nothing; we now have an invalid fd
18
+}
19
20
+net.createServer(common.mustNotCall()).listen({ fd: invalidFd })
21
22
23
function onError(ex) {
0 commit comments