hgmain: explicitly flush IO on exit

Summary: Without this, `hg status --print0` can output nothing and break tests.

Reviewed By: xavierd

Differential Revision: D19387317

fbshipit-source-id: 4feb82889df9bd1705526027f491db90a2a5f946
This commit is contained in:
Jun Wu 2020-01-14 09:40:36 -08:00 committed by Facebook Github Bot
parent c262d1d647
commit 1be7e2ea4c

View File

@ -62,6 +62,11 @@ fn main() {
disable_standard_handle_inheritability().unwrap(); disable_standard_handle_inheritability().unwrap();
let mut io = clidispatch::io::IO::stdio(); let mut io = clidispatch::io::IO::stdio();
let code = hgcommands::run_command(full_args, &mut io); let mut code = hgcommands::run_command(full_args, &mut io);
if io.flush().is_err() {
if code == 0 {
code = 255;
}
}
std::process::exit(code as i32); std::process::exit(code as i32);
} }