[ CLI ] Poll for VM service URI before launching DDS

Service.getInfo().serverUri can be null if the VM service server hasn't
finished starting up. The CLI isolate should wait for this URI to not be
null before attempting to start DDS.

Fixes https://github.com/dart-lang/sdk/issues/44787

Fixed: 44787
Change-Id: Iadce0901351c0bc5238a4dc805483cce818e9e15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190361
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
This commit is contained in:
Ben Konyi
2021-03-12 18:34:08 +00:00
committed by commit-bot@chromium.org
parent 60ea845795
commit 4fde29d1aa
+6 -1
View File
@@ -243,13 +243,18 @@ String maybeUriToFilename(String maybeUri) {
class _DebuggingSession {
Future<bool> start(
String host, String port, bool disableServiceAuthCodes) async {
final serviceInfo = await Service.getInfo();
final ddsSnapshot = (dirname(sdk.dart).endsWith('bin'))
? sdk.ddsSnapshot
: absolute(dirname(sdk.dart), 'gen', 'dds.dart.snapshot');
if (!Sdk.checkArtifactExists(ddsSnapshot)) {
return false;
}
ServiceProtocolInfo serviceInfo = await Service.getInfo();
// Wait for VM service to publish its connection info.
while (serviceInfo.serverUri == null) {
await Future.delayed(Duration(milliseconds: 10));
serviceInfo = await Service.getInfo();
}
final process = await Process.start(
sdk.dart,
[