summaryrefslogtreecommitdiff
path: root/test/parallel/test-net-listen-after-destroying-stdin.js
blob: 5a4c8f4f65c55f5387c384b780150660f777020b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';
// Just test that destroying stdin doesn't mess up listening on a server.
// This is a regression test for
// https://github.com/nodejs/node-v0.x-archive/issues/746.

const common = require('../common');
const net = require('net');

process.stdin.destroy();

const server = net.createServer(common.mustCall(function(socket) {
  console.log('accepted');
  socket.end();
  server.close();
}));


server.listen(0, function() {
  console.log('listening...');

  net.createConnection(this.address().port);
});