From 00996138ba2a283401184d13c73048e7216df706 Mon Sep 17 00:00:00 2001 From: Alistair Brown Date: Mon, 6 Feb 2017 10:34:35 +0000 Subject: [PATCH] Handle promise rejection when using `--open` flag (#780) --- bin/webpack-dev-server.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/webpack-dev-server.js b/bin/webpack-dev-server.js index c5a137e1da..d3352b0aa2 100755 --- a/bin/webpack-dev-server.js +++ b/bin/webpack-dev-server.js @@ -434,8 +434,11 @@ function reportReadiness(uri, options) { console.log(`Content not from webpack is served from ${colorInfo(useColor, contentBase)}`); if(options.historyApiFallback) console.log(`404s will fallback to ${colorInfo(useColor, options.historyApiFallback.index || "/index.html")}`); - if(options.open) - open(uri); + if(options.open) { + open(uri).catch(function() { + console.log("Unable to open browser. If you are running in a headless environment, please do not use the open flag."); + }); + } } processOptions(wpOpt);