Skip to content

Commit

Permalink
fix: generate range before passing to findPort
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 8, 2022
1 parent 6b44c76 commit 848a8c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function getPort (config?: GetPortInput): Promise<PortNumber> {
const portsToCheck: PortNumber[] = [
options.port,
...options.ports,
...generateRange(options.portRange[0], options.portRange[1])
...generateRange(...options.portRange)
].filter((port) => {
if (!port) {
return false
Expand All @@ -82,7 +82,7 @@ export async function getPort (config?: GetPortInput): Promise<PortNumber> {

// Try fallback port range
if (!availablePort) {
availablePort = await findPort(options.alternativePortRange, options.host, options.verbose)
availablePort = await findPort(generateRange(...options.alternativePortRange), options.host, options.verbose)
if (options.verbose) {
log(`Unable to find an available port (tried ${portsToCheck.join(', ')}). Using alternative port:`, availablePort)
}
Expand Down

0 comments on commit 848a8c2

Please sign in to comment.