Skip to content

Commit 0099613

Browse files
alistairjcbrownSpaceK33z
authored andcommitted
Handle promise rejection when using --open flag (#780)
1 parent 04eafa5 commit 0099613

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bin/webpack-dev-server.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,11 @@ function reportReadiness(uri, options) {
434434
console.log(`Content not from webpack is served from ${colorInfo(useColor, contentBase)}`);
435435
if(options.historyApiFallback)
436436
console.log(`404s will fallback to ${colorInfo(useColor, options.historyApiFallback.index || "/index.html")}`);
437-
if(options.open)
438-
open(uri);
437+
if(options.open) {
438+
open(uri).catch(function() {
439+
console.log("Unable to open browser. If you are running in a headless environment, please do not use the open flag.");
440+
});
441+
}
439442
}
440443

441444
processOptions(wpOpt);

0 commit comments

Comments
 (0)