File tree 1 file changed +10
-8
lines changed
packages/create-react-app
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -614,14 +614,16 @@ function checkIfOnline(useYarn) {
614
614
}
615
615
616
616
return new Promise ( resolve => {
617
- let host = 'registry.yarnpkg.com' ;
618
- // If a proxy is defined, we likely can't resolve external hostnames.
619
- // Try to resolve the proxy name as an indication of a connection.
620
- if ( process . env . https_proxy ) {
621
- host = url . parse ( process . env . https_proxy ) . hostname ;
622
- }
623
- dns . lookup ( host , err => {
624
- resolve ( err === null ) ;
617
+ dns . lookup ( 'registry.yarnpkg.com' , err => {
618
+ if ( err != null && process . env . https_proxy ) {
619
+ // If a proxy is defined, we likely can't resolve external hostnames.
620
+ // Try to resolve the proxy name as an indication of a connection.
621
+ dns . lookup ( url . parse ( process . env . https_proxy ) . hostname , proxyErr => {
622
+ resolve ( proxyErr == null ) ;
623
+ } ) ;
624
+ } else {
625
+ resolve ( err == null ) ;
626
+ }
625
627
} ) ;
626
628
} ) ;
627
629
}
You can’t perform that action at this time.
0 commit comments