-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix a BorrowMut error when stdout is closed
#9229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
r? @Eh2406 (rust-highfive has picked a reviewer for you, use r? to override) |
|
r? @ehuss I'm a bit concerned there might be some race conditions in the test. I have a small failure rate on macos (~1%) where the output is: And with --verbose it just tells you that Also, I'm a little concerned that there is a race between spawning cargo and the call to |
|
Oh, I think it might be the race to diff --git a/tests/testsuite/message_format.rs b/tests/testsuite/message_format.rs
index e491de992..497b9f17c 100644
--- a/tests/testsuite/message_format.rs
+++ b/tests/testsuite/message_format.rs
@@ -153,6 +153,7 @@ fn build_no_stdout_still_works() {
.stderr(Stdio::piped())
.spawn()
.unwrap();
+ std::thread::sleep_ms(1000);
drop(cargo.stdout.take());
let mut stderr = String::new();
cargo
@@ -164,6 +165,7 @@ fn build_no_stdout_still_works() {
let status = cargo.wait().unwrap();
assert_eq!(status.code(), Some(101));
+ eprintln!("Actual:\n-----\n{}\n-----", stderr);
// 3 errors, 2 broken pipes (os-specific error message) and a final "build
// failed" error. |
|
Oh, I see, rustc is returning an error (no Maybe this could piggy-back on |
a3068eb to
48b58a3
Compare
|
Oops excellent points! I've updated the test to just check less of the output because Cargo's We should probably change Cargo's build failed exit code from 101 to 1 at some point, since 101 is intended for "rust panicked" |
|
In the case where cargo finishes before stdout is closed, it prints the following error: Unfortunately that does not include the text |
There was one location in the job queue where the shell is borrowed twice by accident, so instead hold the same borrow over both locations. Closes rust-lang#9220
48b58a3 to
3f2ece7
Compare
|
Aha true yeah. I'm not sure this requires too much infrastructure to add a test for, it's a pretty small bug that could happen anywhere within Cargo and this is just one point where we made a mistake. I've removed the test for now because I don't think it's too too necessary, but I'm also not too too motivated to add a super strict test for this either. |
|
Works for me. @bors r+ |
|
📌 Commit 3f2ece7 has been approved by |
|
☀️ Test successful - checks-actions |
Until rust-lang/cargo#9229 is available in stable this will cause tests to fail.
There was one location in the job queue where the shell is borrowed
twice by accident, so instead hold the same borrow over both locations.
Closes #9220