about summary refs log tree commit diff
path: root/library/std/src/process/tests.rs
AgeCommit message (Collapse)AuthorLines
2023-03-06Implement read_buf for a few more typesTomasz Miąsko-1/+33
Implement read_buf for TcpStream, Stdin, StdinLock, ChildStdout, ChildStderr (and internally for AnonPipe, Handle, Socket), so that it skips buffer initialization. The other provided methods like read_to_string and read_to_end are implemented in terms of read_buf and so benefit from the optimization as well. This commit also implements read_vectored and is_read_vectored where applicable.
2022-12-27More verbose `Debug` implementation of `std::process:Command`kraktus-0/+94
based on commit: https://github.com/zackmdavis/rust/commit/ccc019aabfdd550944c049625e66c92c815ea1d0 from https://github.com/zackmdavis close https://github.com/rust-lang/rust/issues/42200 Add env variables and cwd to the shell-like debug output. Also use the alternate syntax to display a more verbose display, while not showing internal fields and hiding fields when they have their default value.
2022-03-23Add test for issue #95178Chris Denton-0/+21
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-9/+5
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
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.