about summary refs log tree commit diff
path: root/library/std/src/process
AgeCommit message (Collapse)AuthorLines
2021-12-23Rollup merge of #92208 - ChrisDenton:win-bat-cmd, r=dtolnayMatthias Krüger-0/+19
Quote bat script command line Fixes #91991 [`CreateProcessW`](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw#parameters) should only be used to run exe files but it does have some (undocumented) special handling for files with `.bat` and `.cmd` extensions. Essentially those magic extensions will cause the parameters to be automatically rewritten. Example pseudo Rust code (note that `CreateProcess` starts with an optional application name followed by the application arguments): ```rust // These arguments... CreateProcess(None, `@"foo.bat` "hello world""`@,` ...); // ...are rewritten as CreateProcess(Some(r"C:\Windows\System32\cmd.exe"), `@""foo.bat` "hello world"""`@,` ...); ``` However, when setting the first parameter (the application name) as we now do, it will omit the extra level of quotes around the arguments: ```rust // These arguments... CreateProcess(Some("foo.bat"), `@"foo.bat` "hello world""`@,` ...); // ...are rewritten as CreateProcess(Some(r"C:\Windows\System32\cmd.exe"), `@"foo.bat` "hello world""`@,` ...); ``` This means the arguments won't be passed to the script as intended. Note that running batch files this way is undocumented but people have relied on this so we probably shouldn't break it.
2021-12-22Fix testsChris Denton-3/+7
2021-12-16Quote bat script command lineChris Denton-0/+19
2021-11-23fix test in std::process on androidname1e5s-28/+36
2021-10-30Use "rustc" for testing Command argsChris Denton-3/+3
"echo" is not an application on Windows so `Command` tests could fail even if that's not what's being tested for.
2021-06-24Test that `env_clear` works on WindowsChris Denton-0/+9
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-0/+401
Also doing fmt inplace as requested.