Skip to content

Commit 55ff8ba

Browse files
authored
feat: retry when err.code is EACCES (#104)
1 parent 237bd7c commit 55ff8ba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/wait-port.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ function tryConnect(options, timeout) {
8484
try {
8585
const socket = createConnectionWithTimeout(options, timeout, (err) => {
8686
if (err) {
87-
if (err.code === 'ECONNREFUSED') {
87+
if (err.code === 'ECONNREFUSED' || err.code === 'EACCES') {
8888
// We successfully *tried* to connect, so resolve with false so
8989
// that we try again.
90-
debug('Socket not open: ECONNREFUSED');
90+
debug(`Socket not open: ${err.code}`);
9191
socket.destroy();
9292
return resolve(false);
9393
} else if (err.code === 'ECONNTIMEOUT') {
@@ -245,3 +245,6 @@ function waitPort(params) {
245245
}
246246

247247
module.exports = waitPort;
248+
waitPort({
249+
port: 3000
250+
})

0 commit comments

Comments
 (0)