We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dce7d7f commit 112b655Copy full SHA for 112b655
test/parallel/test-listen-fd-ebadf.js
@@ -21,12 +21,24 @@
21
22
'use strict';
23
const common = require('../common');
24
+
25
const assert = require('assert');
26
+const fs = require('fs');
27
const net = require('net');
28
29
net.createServer(common.mustNotCall()).listen({ fd: 2 })
30
.on('error', common.mustCall(onError));
-net.createServer(common.mustNotCall()).listen({ fd: 42 })
31
32
+let invalidFd = 2;
33
34
+// Get first known bad file descriptor.
35
+try {
36
+ while (fs.fstatSync(++invalidFd));
37
+} catch (e) {
38
+ // do nothing; we now have an invalid fd
39
+}
40
41
+net.createServer(common.mustNotCall()).listen({ fd: invalidFd })
42
43
44
function onError(ex) {
0 commit comments