You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
The `cmd.exe` does not use the "common" argv[] parsing [1] [2]. For example, the Rust code:
Command::new("cmd.exe").arg("/c").arg(r#"notepad "a b.txt"#)
will execute (Windows OS command line, as a single string):
cmd.exe /c "notepad \"a b.txt\""
which will execute:
notepad \"a b.txt\"
and notepad will complain that the file cannot be found.
To fix it we need to pass the unquoted command and execute either:
cmd.exe /c "notepad "a b.txt""
cmd.exe /c notepad "a b.txt"
which will execute:
notepad "a b.txt"
See also rust-lang/rust#29494.
[1]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw
[2]: https://learn.microsoft.com/en-us/cpp/c-language/parsing-c-command-line-arguments
Reviewed By: zzl0
Differential Revision: D47242639
fbshipit-source-id: c75aa83430520c29002a095333546cc48695244e
0 commit comments