about summary refs log tree commit diff
path: root/library/std/src/process/tests.rs
AgeCommit message (Collapse)AuthorLines
2025-09-19Fix test suite in iOS/tvOS/watchOS/visionOS simulatorMads Marquart-19/+83
2025-02-13std: Apply deprecated_safe_2024Eric Huss-2/+6
2025-02-08Rollup merge of #135696 - joboet:move_pal_io, r=NoratriebMatthias Krüger-2/+2
std: move `io` module out of `pal`, get rid of `sys_common::io` Part of #117276. This does two related things: 1. It moves the platform-specific definitions for `IoSlice`, `IoSliceMut` and `is_terminal` out of `pal` and into `sys` and unifies some of them. 2. It gets rid of `sys_common::io`, moving the non-platform-specific test helpers into `std::test_helpers` and the buffer size definition to the new `sys::io` module.
2025-02-07std: get rid of `sys_common::io`joboet-2/+2
2025-02-07Move two windows process tests to tests/uiChris Denton-148/+0
2025-02-06tests(std): don't output to std{out,err} in `test_creation_flags` and ↵许杰友 Jieyou Xu (Joe)-3/+12
`test_proc_thread_attributes`
2024-11-30Abstract `ProcThreadAttributeList` into its own structMichael van Straten-6/+8
2024-10-23[musl] use posix_spawn if a directory change was requestedRain-0/+14
Currently, not all libcs have the `posix_spawn_file_actions_addchdir_np` symbol available to them. So we attempt to do a weak symbol lookup for that function. But that only works if libc is a dynamic library -- with statically linked musl binaries the symbol lookup would never work, so we would never be able to use it even if the musl in use supported the symbol. Now that Rust has a minimum musl version of 1.2.3, all supported musl versions now include this symbol, so we can unconditionally expect it to be there. This symbol was added to libc in https://github.com/rust-lang/libc/pull/3949 -- use it here. I couldn't find any tests for whether the posix_spawn path is used, but I've verified with cargo-nextest that this change works. This is a substantial improvement to nextest's performance with musl. On my workstation with a Ryzen 7950x, against https://github.com/clap-rs/clap at 61f5ee514f8f60ed8f04c6494bdf36c19e7a8126: Before: ``` Summary [ 1.071s] 879 tests run: 879 passed, 0 skipped ``` After: ``` Summary [ 0.392s] 879 tests run: 879 passed, 0 skipped ``` Fixes #99740.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-15Remove DWORDChris Denton-13/+9
2024-07-10Don't mark `DEBUG_EVENT` struct as `repr(packed)`Tobias Bucher-1/+1
That would give it alignment of 1 which is ABI-incompatible with its C definition.
2024-06-24Replace `MaybeUninit::uninit_array()` with array repeat expression.Kevin Reid-1/+1
This is possible now that inline const blocks are stable; the idea was even mentioned as an alternative when `uninit_array()` was added: <https://github.com/rust-lang/rust/pull/65580#issuecomment-544200681> > if it’s stabilized soon enough maybe it’s not worth having a > standard library method that will be replaceable with > `let buffer = [MaybeUninit::<T>::uninit(); $N];` Const array repetition and inline const blocks are now stable (in the next release), so that circumstance has come to pass, and we no longer have reason to want `uninit_array()` other than convenience. Therefore, let’s evaluate the inconvenience by not using `uninit_array()` in the standard library, before potentially deleting it entirely.
2023-09-22Rollup merge of #114379 - RalfJung:command-removed-env-vars, r=m-ou-seMatthias Krüger-1/+46
Command: also print removed env vars There is no real shell syntax for unsetting an env var so easily, so we have to make one up. But we already do that for showing the 'program' name so I hope that's okay here, too. No strong opinion on what that should look like, I went with `unset(VAR_NAME)` for now.
2023-08-25Added option to set ProcThreadAttributes for Windows processesMichael van Straten-0/+85
This implements the ability to add arbitrary attributes to a command on Windows targets using a new `raw_attribute` method on the [`CommandExt`](https://doc.rust-lang.org/stable/std/os/windows/process/trait.CommandExt.html) trait. Setting these attributes provides extended configuration options for Windows processes. Co-authored-by: Tyler Ruckinger <t.ruckinger@gmail.com>
2023-08-24also use 'env' for printing unsettingRalf Jung-1/+1
2023-08-24also print clearing the environment entirelyRalf Jung-0/+23
2023-08-24make unsetting env vars print as executable commandRalf Jung-2/+3
2023-08-24Command: also print removed env varsRalf Jung-1/+22
2023-07-05Workaround for old android not having echoChris Denton-1/+8
2023-07-04Test Child::kill behaviour on exited processChris Denton-0/+8
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.