mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00

Fix hang on broken stderr. If stderr is closed and cargo tries to print a status message such as "Compiling", cargo can get into a hung state. This is because the `DrainState::run` function would insert the job into the `active` queue, and then return an error without starting the job. Since the job isn't started, there is nothing to remove it from the `active` queue, and thus cargo hangs forever waiting for it to finish. The solution is to move the call to `note_working_on` earlier before the job is placed into the active queue. This addresses the issue noted in https://github.com/rust-lang/cargo/issues/8714#issuecomment-783787163.