diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-12-26 23:59:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-26 23:59:52 +0000 |
commit | c5f82fe553e90d914c1df4976af1d081db66793a (patch) | |
tree | 44c0026946866bc11efecb6909371a61f2959f41 | |
parent | fba8df385cc7d444927a6dbc4ab95303653c97ad (diff) |
Wait for pager process before exiting (#469)
Fixes #463
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index a5c789b9..31576463 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,6 +27,7 @@ mod syntect_color; mod tests; use std::io::{self, ErrorKind, Read, Write}; +use std::mem; use std::path::PathBuf; use std::process; @@ -80,12 +81,14 @@ fn main() -> std::io::Result<()> { let mut writer = output_type.handle().unwrap(); if atty::is(atty::Stream::Stdin) { - process::exit(diff( + let exit_code = diff( config.minus_file.as_ref(), config.plus_file.as_ref(), &config, &mut writer, - )); + ); + mem::drop(output_type); + process::exit(exit_code); } if let Err(error) = delta(io::stdin().lock().byte_lines(), &mut writer, &config) { |