[ 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:
@@ -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() {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user