std::process::Command::spawn cause panic on Windows 10 21H2 19044.2846
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
#[test]
fn test2() {
std::process::Command::new("adb")
.args(["devices"])
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()
.unwrap();
}
Only panics when using use std::process::Command; in Test Debug mode, but not in other cases.
And only panic on Windows 10 21H2 19044.2846.
Here is an issue discussing this problem, and it includes two videos of about ten seconds to demonstrate the situation.
https://github.com/tokio-rs/tokio/issues/6934
Meta
rustc --version --verbose:
rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: x86_64-pc-windows-msvc
release: 1.82.0
LLVM version: 19.1.1
Backtrace
test test2 ... FAILED
successes:
successes:
failures:
---- test2 stdout ----
thread 'test2' panicked at src/main.rs:80:6:
called `Result::unwrap()` on an `Err` value: Os { code: 6, kind: Uncategorized, message: "鍙ユ焺鏃犳晥銆? }
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/std\src\panicking.rs:662
1: core::panicking::panic_fmt
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/core\src\panicking.rs:74
2: core::result::unwrap_failed
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/core\src\result.rs:1677
3: enum2$<core::result::Result<std::process::Child,std::io::error::Error> >::unwrap
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library\core\src\result.rs:1102
4: static_lib::test2
at .\src\main.rs:77
5: static_lib::test2::closure$0
at .\src\main.rs:76
6: core::ops::function::FnOnce::call_once<static_lib::test2::closure_env$0,tuple$<> >
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library\core\src\ops\function.rs:250
7: core::ops::function::FnOnce::call_once
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14\library/core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
2
failures:
test2
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s
I deciphered the garbled message, and it seems to mean "The handle is invalid."
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the test2 reproducer using std::process::Command::spawn and compare its behavior in Test Debug mode on Windows 10 21H2 with the other reported cases. Read the linked Tokio issue for related observations. Done means the reported panic or invalid-handle error is reproduced, understood, and covered by an appropriate regression test or documented limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100