Skip to content

Commit

Permalink
inspector: end connections used to check availability of the port
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Aug 23, 2022
1 parent ceb9960 commit 25c4df2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/internal/debugger/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ async function portIsFree(host, port, timeout = 3000) {
const error = await new Promise((resolve) => {
const socket = net.connect(port, host);
socket.on('error', resolve);
socket.on('connect', resolve);
socket.on('connect', () => {
socket.end();
resolve();
});
});
if (error?.code === 'ECONNREFUSED') {
return;
Expand Down

0 comments on commit 25c4df2

Please sign in to comment.