Skip to content

Commit 8a0ae57

Browse files
zichanggcommit-bot@chromium.org
authored andcommitted
[vm] escape path when creating process on Windows
path may contain spaces. When it is passed into CreatProcessW, it will interpret in several ways. Escape path for CreateProcessW to remove ambiguity. The api doc of CreateProcessW: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw#parameters Bug: #37751 Change-Id: Ia3486d9a8c6b38c526c651dd6a801e0b8dad8655 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112267 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Zichang Guo <zichangguo@google.com>
1 parent 82b06db commit 8a0ae57

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

runtime/bin/process_patch.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,14 @@ class _ProcessImpl extends _ProcessImplNativeWrapper implements Process {
233233
if (path is! String) {
234234
throw new ArgumentError("Path is not a String: $path");
235235
}
236-
_path = path;
236+
237+
if (Platform.isWindows) {
238+
// Escape paths that may contain spaces
239+
// Bug: https://github.com/dart-lang/sdk/issues/37751
240+
_path = _windowsArgumentEscape(path);
241+
} else {
242+
_path = path;
243+
}
237244

238245
if (arguments is! List) {
239246
throw new ArgumentError("Arguments is not a List: $arguments");

0 commit comments

Comments
 (0)