Do not attempt to DNS resolve localhost Fixes #4290

21d4c37846790a1ef4285d6c5aaa17ff14fa41b5

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +2 -4Showing whitespace changes
src/command-line.js+2 -4
@@ -4,7 +4,7 @@ import yargs from 'yargs/yargs';
4import { hideBin } from 'yargs/helpers';4import { hideBin } from 'yargs/helpers';
5import ipRegex from 'ip-regex';5import ipRegex from 'ip-regex';
6import envPaths from 'env-paths';6import envPaths from 'env-paths';
7import { canResolve, color, getConfigValue, stringToBool } from './util.js';7import { color, getConfigValue, stringToBool } from './util.js';
8import { initConfig } from './config-init.js';8import { initConfig } from './config-init.js';
99
10/**10/**
@@ -314,10 +314,8 @@ export class CommandLineParser {
314 },314 },
315 getBrowserLaunchHostname: async function ({ useIPv6, useIPv4 }) {315 getBrowserLaunchHostname: async function ({ useIPv6, useIPv4 }) {
316 if (this.browserLaunchHostname === 'auto') {316 if (this.browserLaunchHostname === 'auto') {
317 const localhostResolve = await canResolve('localhost', useIPv6, useIPv4);
318
319 if (useIPv6 && useIPv4) {317 if (useIPv6 && useIPv4) {
320 return (this.browserLaunchAvoidLocalhost || !localhostResolve) ? '[::1]' : 'localhost';318 return this.browserLaunchAvoidLocalhost ? '[::1]' : 'localhost';
321 }319 }
322320
323 if (useIPv6) {321 if (useIPv6) {