diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-02-06 16:59:40 +0800 |
|---|---|---|
| committer | Jieyou Xu <jieyouxu@outlook.com> | 2025-02-06 17:18:00 +0800 |
| commit | 9c5f025c18c0b77a2218d5eefbb915b4f7936382 (patch) | |
| tree | b6dd623580e1cbfe67a04a4c0ef4d87764a771e3 | |
| parent | 51bc4c9509b9e505c224904d5b378e63bf625c6d (diff) | |
| download | rust-9c5f025c18c0b77a2218d5eefbb915b4f7936382.tar.gz rust-9c5f025c18c0b77a2218d5eefbb915b4f7936382.zip | |
tests(std): don't output to std{out,err} in `test_creation_flags` and `test_proc_thread_attributes`
| -rw-r--r-- | library/std/src/process/tests.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs index e8cbfe337bc..1323aba38b7 100644 --- a/library/std/src/process/tests.rs +++ b/library/std/src/process/tests.rs @@ -418,8 +418,13 @@ fn test_creation_flags() { const EXIT_PROCESS_DEBUG_EVENT: u32 = 5; const DBG_EXCEPTION_NOT_HANDLED: u32 = 0x80010001; - let mut child = - Command::new("cmd").creation_flags(DEBUG_PROCESS).stdin(Stdio::piped()).spawn().unwrap(); + let mut child = Command::new("cmd") + .creation_flags(DEBUG_PROCESS) + .stdin(Stdio::piped()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .spawn() + .unwrap(); child.stdin.take().unwrap().write_all(b"exit\r\n").unwrap(); let mut events = 0; let mut event = DEBUG_EVENT { event_code: 0, process_id: 0, thread_id: 0, _junk: [0; 164] }; @@ -486,9 +491,13 @@ fn test_proc_thread_attributes() { } } - let parent = ProcessDropGuard(Command::new("cmd").spawn().unwrap()); + let mut parent = Command::new("cmd"); + parent.stdout(Stdio::null()).stderr(Stdio::null()); + + let parent = ProcessDropGuard(parent.spawn().unwrap()); let mut child_cmd = Command::new("cmd"); + child_cmd.stdout(Stdio::null()).stderr(Stdio::null()); let parent_process_handle = parent.0.as_raw_handle(); |
