mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-29 01:45:40 +08:00
Use a 'BROWSER' environment variable with npm start to specify which browser to open. if the value of 'BROWSER' is not valid executable file, don't open any browser.
This commit is contained in:
committed by
Dan Abramov
parent
2b2b8ff338
commit
759806ed4f
3
packages/react-dev-utils/openBrowser.js
vendored
3
packages/react-dev-utils/openBrowser.js
vendored
@@ -28,7 +28,8 @@ function openBrowser(url) {
|
||||
// Fallback to opn
|
||||
// (It will always open new tab)
|
||||
try {
|
||||
opn(url).catch(() => {}); // Prevent `unhandledRejection` error.
|
||||
var option = {app: process.env.BROWSER};
|
||||
opn(url, option).catch(() => {}); // Prevent `unhandledRejection` error.
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user