File tree Expand file tree Collapse file tree
packages/create-react-app Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -614,14 +614,16 @@ function checkIfOnline(useYarn) {
614614 }
615615
616616 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+ }
625627 } ) ;
626628 } ) ;
627629}
You can’t perform that action at this time.
0 commit comments