Configure which browser to open in npm start (#873) (#1148)

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:
Gabriel Aumala
2016-12-11 15:16:35 -05:00
committed by Dan Abramov
parent 2b2b8ff338
commit 759806ed4f

View File

@@ -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;