Skip to content

Commit

Permalink
[vm] escape path when creating process on Windows
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
zichangg authored and commit-bot@chromium.org committed Aug 8, 2019
1 parent 82b06db commit 8a0ae57
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion runtime/bin/process_patch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,14 @@ class _ProcessImpl extends _ProcessImplNativeWrapper implements Process {
if (path is! String) {
throw new ArgumentError("Path is not a String: $path");
}
_path = path;

if (Platform.isWindows) {
// Escape paths that may contain spaces
// Bug: https://github.com/dart-lang/sdk/issues/37751
_path = _windowsArgumentEscape(path);
} else {
_path = path;
}

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

0 comments on commit 8a0ae57

Please sign in to comment.