File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -407,18 +407,28 @@ async function setup () {
407407 `The WPT require certain entries to be present in your ${ hostsPath } file. Should these be configured automatically? (y/n): ` ,
408408 resolve
409409 )
410- } ) . finally ( ( ) => rl . close ( ) )
410+ } ) . finally ( ( ) => rl . close ( ) ) . then ( ( a ) => a . trim ( ) . toLowerCase ( ) )
411411
412- if ( answer . toLowerCase ( ) === 'y' || answer . toLowerCase ( ) === 'yes' ) {
413- await setupHostsFile ( )
414- } else {
412+ let hostsModified = false
413+ if ( answer === 'y' || answer === 'yes' ) {
414+ try {
415+ await setupHostsFile ( )
416+ hostsModified = true
417+ } catch ( err ) {
418+ console . error ( '❌ \x1B[31mAutomatic configuration failed.\x1B[0m' )
419+ }
420+ }
421+ if ( ! hostsModified ) {
415422 console . log ( 'Please configure hosts file manually:' )
416423 console . log ( `cd ${ WPT_DIR } ` )
417424 if ( process . platform === 'win32' ) {
418425 console . log ( 'python wpt make-hosts-file | Out-File $env:SystemRoot\\System32\\drivers\\etc\\hosts -Encoding ascii -Append' )
419426 } else {
420427 console . log ( 'python3 wpt make-hosts-file | sudo tee -a /etc/hosts' )
421428 }
429+
430+ console . log ( '❌ \x1B[31mSetup incomplete.\x1B[0m' )
431+ process . exit ( 1 )
422432 }
423433 }
424434
You can’t perform that action at this time.
0 commit comments