rust/library/std/src/sys
Matthias Krüger 3afed8fc70
Rollup merge of #92208 - ChrisDenton:win-bat-cmd, r=dtolnay
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-23 00:28:56 +01:00
..
common std: Get the standard library compiling for wasm64 2021-11-10 08:35:42 -08:00
hermit Auto merge of #81156 - DrMeepster:read_buf, r=joshtriplett 2021-12-09 10:11:55 +00:00
itron Fix a bunch of typos 2021-12-14 16:40:43 +01:00
sgx Stabilize asm! and global_asm! 2021-12-12 11:20:03 +00:00
solid kmc-solid: Add std::sys::solid::fs::File::read_buf 2021-12-21 11:18:35 +09:00
unix Revert "socket ancillary data implementation for dragonflybsd." 2021-12-16 21:32:53 +00:00
unsupported Update library/std/src/sys/unsupported/fs.rs 2021-11-02 22:47:27 -07:00
wasi more efficent File::read_buf impl for windows and unix 2021-11-02 22:47:26 -07:00
wasm Fix a bunch of typos 2021-12-14 16:40:43 +01:00
windows Rollup merge of #92208 - ChrisDenton:win-bat-cmd, r=dtolnay 2021-12-23 00:28:56 +01:00
mod.rs Use target_family = "wasm" 2021-11-10 08:35:42 -08:00