[ 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 <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
This commit is contained in:
Ben Konyi
2025-06-16 10:59:57 -07:00
committed by Commit Queue
parent 6d0bfb4e9f
commit c2616e1d80
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -90,11 +90,9 @@ ${result.stderr}
]);
final uriCompleter = Completer<String>();
final uriRegExp = RegExp('Serving `web` on (http://.*)');
late StreamSubscription<String> sub;
sub = process.stdout.transform(utf8.decoder).listen((e) {
final sub = process.stdout.transform(utf8.decoder).listen((e) {
if (uriRegExp.hasMatch(e)) {
uriCompleter.complete(uriRegExp.firstMatch(e)!.group(1));
sub.cancel();
}
});
@@ -105,6 +103,11 @@ ${result.stderr}
Chrome.start(<String>[observatoryUri]);
}
await process.exitCode;
// Don't cancel this stream until the process has exited as it will close
// the file descriptor for stdout and cause a crash when webdev tries to
// write logs.
await sub.cancel();
}
String _findObservatoryProjectRoot() {
+1 -1
View File
@@ -4,7 +4,7 @@
import 'package:web/web.dart';
import 'package:logging/logging.dart';
import '../lib/elements.dart';
import 'package:observatory/elements.dart';
import 'package:stack_trace/stack_trace.dart';
main() async {