File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -922,17 +922,21 @@ export function unique<T>(arr: T[]): T[] {
922922 * Even if defaultResultOrder is `ipv4first`, `dns.lookup` result maybe same.
923923 * For example, when IPv6 is not supported on that machine/network.
924924 */
925- export async function getLocalhostAddressIfDiffersFromDNS ( ) : Promise <
926- string | undefined
927- > {
928- const [ nodeResult , dnsResult ] = await Promise . all ( [
925+ export function getLocalhostAddressIfDiffersFromDNS ( ) :
926+ | Promise < string | undefined >
927+ | undefined {
928+ if ( dns . getDefaultResultOrder ( ) === 'verbatim' ) {
929+ return undefined
930+ }
931+ return Promise . all ( [
929932 dns . lookup ( 'localhost' ) ,
930933 dns . lookup ( 'localhost' , { verbatim : true } ) ,
931- ] )
932- const isSame =
933- nodeResult . family === dnsResult . family &&
934- nodeResult . address === dnsResult . address
935- return isSame ? undefined : nodeResult . address
934+ ] ) . then ( ( [ nodeResult , dnsResult ] ) => {
935+ const isSame =
936+ nodeResult . family === dnsResult . family &&
937+ nodeResult . address === dnsResult . address
938+ return isSame ? undefined : nodeResult . address
939+ } )
936940}
937941
938942export function diffDnsOrderChange (
You can’t perform that action at this time.
0 commit comments