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

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

Issue 1187103004: Allow Suites to be added to an Engine over time. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 6 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
Index: lib/src/runner/browser/browser.dart
diff --git a/lib/src/runner/browser/browser.dart b/lib/src/runner/browser/browser.dart
index 9891342a6ea1e2e9444c0fe12c0c23b38677661e..f3a68f0655498f0f08d8a245420ea77a4edf993e 100644
--- a/lib/src/runner/browser/browser.dart
+++ b/lib/src/runner/browser/browser.dart
@@ -57,6 +57,20 @@ abstract class Browser {
var exitCode = await process.exitCode;
+ // This hack dodges an otherwise intractable race condition. When the user
+ // presses Control-C, the signal is sent to the browser and the test
+ // runner at the same time. It's possible for the browser to exit before
+ // the [Browser.close] is called, which would trigger the error below.
+ //
+ // A negative exit code signals that the process exited due to a signal.
+ // However, it's possible that this signal didn't come from the user's
+ // Control-C, in which case we do want to throw the error. The only way to
+ // resolve the ambiguity is to wait a brief amount of time and see if this
+ // browser is actually closed.
+ if (!_closed && exitCode < 0) {
+ await new Future.delayed(new Duration(milliseconds: 200));
+ }
+
if (!_closed && exitCode != 0) {
throw new ApplicationException(
"$name failed with exit code $exitCode.");

Powered by Google App Engine
This is Rietveld 408576698