Skip to content

Commit c2616e1

Browse files
bkonyiCommit Queue
authored andcommitted
[ Observatory ] Fix bad import and bin/observatory.dart crash
Change-Id: I299facbd77522ccdb90dfdd2871f7bf23103b975 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434840 Reviewed-by: Derek Xu <[email protected]> Commit-Queue: Ben Konyi <[email protected]> Auto-Submit: Ben Konyi <[email protected]> Reviewed-by: Jessy Yameogo <[email protected]>
1 parent 6d0bfb4 commit c2616e1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pkg/observatory/bin/observatory.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,9 @@ ${result.stderr}
9090
]);
9191
final uriCompleter = Completer<String>();
9292
final uriRegExp = RegExp('Serving `web` on (http://.*)');
93-
late StreamSubscription<String> sub;
94-
sub = process.stdout.transform(utf8.decoder).listen((e) {
93+
final sub = process.stdout.transform(utf8.decoder).listen((e) {
9594
if (uriRegExp.hasMatch(e)) {
9695
uriCompleter.complete(uriRegExp.firstMatch(e)!.group(1));
97-
sub.cancel();
9896
}
9997
});
10098

@@ -105,6 +103,11 @@ ${result.stderr}
105103
Chrome.start(<String>[observatoryUri]);
106104
}
107105
await process.exitCode;
106+
107+
// Don't cancel this stream until the process has exited as it will close
108+
// the file descriptor for stdout and cause a crash when webdev tries to
109+
// write logs.
110+
await sub.cancel();
108111
}
109112

110113
String _findObservatoryProjectRoot() {

pkg/observatory/web/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import 'package:web/web.dart';
66
import 'package:logging/logging.dart';
7-
import '../lib/elements.dart';
7+
import 'package:observatory/elements.dart';
88
import 'package:stack_trace/stack_trace.dart';
99

1010
main() async {

0 commit comments

Comments
 (0)