From 5f12a95a77c4e636d0ba0478e84abe1d1827f728 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Fri, 26 May 2023 12:20:46 -0400 Subject: [PATCH] Fix adding options.host to defaultHosts list --- lib/portfinder.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/portfinder.js b/lib/portfinder.js index 2bc65e2..0ab2f3e 100644 --- a/lib/portfinder.js +++ b/lib/portfinder.js @@ -141,10 +141,8 @@ exports.getPort = function (options, callback) { } } - if (options.host) { - if (exports._defaultHosts.indexOf(options.host) !== -1) { - exports._defaultHosts.push(options.host) - } + if (options.host && exports._defaultHosts.indexOf(options.host) === -1) { + exports._defaultHosts.push(options.host) } var openPorts = [], currentHost;