mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-22 11:57:27 +08:00
Catch and noop call to open web browser. (#964)
Running `create-react-app` in a Docker container causes an unhandled rejection error in nodejs > 6.5 because the `opn` module tries to open a web browser in a system that doesn't have one. I figured this error could be safely ignored.
This commit is contained in:
committed by
Dan Abramov
parent
91c86502a4
commit
0bd593baa7
2
packages/react-dev-utils/openBrowser.js
vendored
2
packages/react-dev-utils/openBrowser.js
vendored
@@ -28,7 +28,7 @@ function openBrowser(url) {
|
||||
// Fallback to opn
|
||||
// (It will always open new tab)
|
||||
try {
|
||||
opn(url);
|
||||
opn(url).catch(() => {}); // Prevent `unhandledRejection` error.
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user