Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: lib/src/runner/browser/browser_manager.dart

Issue 1062943005: Make BrowserManager resilient to an early exit. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/src/util/multi_channel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/browser/browser_manager.dart
diff --git a/lib/src/runner/browser/browser_manager.dart b/lib/src/runner/browser/browser_manager.dart
index 6fd0a8abeb5b6fc4b3622abc1ad54e7a93bcd747..456ca47a08bce85346de4959e7517681b1eea14a 100644
--- a/lib/src/runner/browser/browser_manager.dart
+++ b/lib/src/runner/browser/browser_manager.dart
@@ -50,7 +50,12 @@ class BrowserManager {
// Create a nested MultiChannel because the iframe will be using a channel
// wrapped within the host's channel.
suiteChannel = new MultiChannel(suiteChannel.stream, suiteChannel.sink);
- return suiteChannel.stream.first.then((response) {
+
+ // The stream may close before emitting a value if the browser is killed
+ // prematurely (e.g. via Control-C).
+ return maybeFirst(suiteChannel.stream).then((response) {
+ if (response == null) return null;
+
if (response["type"] == "loadException") {
return new Future.error(new LoadException(path, response["message"]));
} else if (response["type"] == "error") {
« no previous file with comments | « no previous file | lib/src/util/multi_channel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698