diff --git a/CHANGELOG.md b/CHANGELOG.md index 947822212..e3c59dd10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.12.26+1 + +* Fix lower bound on package `stack_trace`. Now 1.6.0. +* Manually close browser process streams to prevent test hangs. + ## 0.12.26 * The `spawnHybridUri()` function now allows root-relative URLs, which are diff --git a/lib/src/runner/browser/browser.dart b/lib/src/runner/browser/browser.dart index e1602317e..e587f613b 100644 --- a/lib/src/runner/browser/browser.dart +++ b/lib/src/runner/browser/browser.dart @@ -51,9 +51,12 @@ abstract class Browser { Future get onExit => _onExitCompleter.future; final _onExitCompleter = new Completer(); + /// Standard IO streams for the underlying browser process. + final _ioSubscriptions = []; + Future _drainAndIgnore(Stream s) async { try { - await s.drain(); + _ioSubscriptions.add(s.listen(null, cancelOnError: true)); } on StateError catch (_) {} } @@ -72,8 +75,8 @@ abstract class Browser { _processCompleter.complete(process); // If we don't drain the stdout and stderr the process can hang. - await Future.wait( - [_drainAndIgnore(process.stdout), _drainAndIgnore(process.stderr)]); + _drainAndIgnore(process.stdout); + _drainAndIgnore(process.stderr); var exitCode = await process.exitCode; @@ -120,6 +123,13 @@ abstract class Browser { Future close() { _closed = true; + // If we don't manually close the stream the test runner can hang. + // For example this happens with Chrome Headless. + // See SDK issue: https://github.com/dart-lang/sdk/issues/31264 + for (var stream in _ioSubscriptions) { + stream.cancel(); + } + _process.then((process) { // Dartium has a difficult time being killed on Linux. To ensure it is // properly closed, find all children processes and kill those first. diff --git a/pubspec.yaml b/pubspec.yaml index f3e561fba..8cdb1fc52 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: test -version: 0.12.26 +version: 0.12.26+1 author: Dart Team description: A library for writing dart unit tests. homepage: https://github.com/dart-lang/test