Skip to content

Commit 66b9bf5

Browse files
committed
[beta] [ Service ] Include drive letter in path when launching DDS snapshot
The previous logic for building the path to dds.dart.snapshot would result in the Windows drive letter being dropped from the path: \path\to\dart-sdk\bin\dds.dart.snapshot This works most of the time since a leading slash is treated as a reference to the current drive, which often contains the Dart SDK. However, if the SDK is on a different drive than the current (e.g., in a container with two drives), the VM will fail to find the snapshot. This change uses the File(...) APIs from dart:io to build the path rather than trying to use the Uri class to manually hack together a path. TEST=N/A, not reproducible without a second Windows drive Bug: grpc/grpc-dart#697 Change-Id: I71d00b07a98508a780f5aab76417da4aa530f3c4 Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/360920 Cherry-pick-request: #55386 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361400 Reviewed-by: Siva Annamalai <[email protected]>
1 parent 9bf485f commit 66b9bf5

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

sdk/lib/_internal/vm/bin/vmservice_io.dart

+3-13
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,15 @@ class _DebuggingSession {
9696
bool disableServiceAuthCodes,
9797
bool enableDevTools,
9898
) async {
99-
final dartPath = Uri.parse(Platform.resolvedExecutable);
100-
final dartDir = [
101-
'', // Include leading '/'
102-
...dartPath.pathSegments.sublist(
103-
0,
104-
dartPath.pathSegments.length - 1,
105-
),
106-
].join('/');
107-
99+
final dartDir = File(Platform.resolvedExecutable).parent.path;
108100
final fullSdk = dartDir.endsWith('bin');
109101
final snapshotName = [
110102
dartDir,
111103
fullSdk ? 'snapshots' : 'gen',
112104
'dds.dart.snapshot',
113-
].join('/');
114-
final execName = dartPath.toString();
115-
105+
].join(Platform.pathSeparator);
116106
_process = await Process.start(
117-
execName,
107+
Platform.resolvedExecutable,
118108
[
119109
snapshotName,
120110
'--vm-service-uri=${server!.serverAddress!}',

0 commit comments

Comments
 (0)