Vite trigger MacOS system dialog to locate 'undefined' application when Google Chrome is not running #11205
Closed
7 tasks done
Labels
bug
Something isn't working
Describe the bug
Vite feature to open running instance of Chrome browsers doesn't fail immediately when Chrome is not running (openedBrowser is undefined), instead MacOS system dialog
"Choose Application" - "Where is undefined?"
is displayed. Only after closing this dialog, exception is thrown and catched in script and continue to opening new Google Chrome instance.Please don't execute osascript with undefined openedBrowser or use value from preferredOSXBrowser when openedBrowser is undefined.
https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/openBrowser.ts#L93
Reproduction
https://stackblitz.com/edit/vitejs-vite-hntcyg?file=package.json
Steps to reproduce
vite 3.2.5
be sure there is no running process 'Google Chrome'
execute command:
BROWSER="Google Chrome" vite
MacOS system dialog
"Choose Application" - "Where is undefined?"
is displayed because vite execute:osascript openChrome.applescript http://127.0.0.1:8080/index.html undefined
https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/openBrowser.ts#L93
System Info
System: OS: macOS 12.6 Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.14.2 npm: 8.5.0 Browsers: Chrome: 107.0.5304.121 Firefox: 106.0.2 Safari: 16.0 npmPackages: vite: ^3.2.5 => 3.2.5
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: