Skip to content

Commit 4e01fa0

Browse files
committed
process_wrapper: properly kill the process without waiting for it to exit
1 parent 886dc32 commit 4e01fa0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

util/process_wrapper/main.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,16 @@ fn main() {
9494
let quit_on_rmeta = opts.rustc_quit_on_rmeta;
9595
// Process json rustc output and kill the subprocess when we get a signal
9696
// that we emitted a metadata file.
97-
let mut metadata_emitted = false;
97+
let mut me = false;
98+
let metadata_emitted = &mut me;
9899
let result = process_output(&mut child_stderr, stderr.as_mut(), move |line| {
99100
if quit_on_rmeta {
100-
rustc::stop_on_rmeta_completion(line, format, &mut metadata_emitted)
101+
rustc::stop_on_rmeta_completion(line, format, metadata_emitted)
101102
} else {
102103
rustc::process_json(line, format)
103104
}
104105
});
105-
if metadata_emitted {
106+
if me {
106107
// If recv returns Ok(), a signal was sent in this channel so we should terminate the child process.
107108
// We can safely ignore the Result from kill() as we don't care if the process already terminated.
108109
let _ = child.kill();

0 commit comments

Comments
 (0)