Skip to content

Commit

Permalink
Wait for pager process before exiting (#469)
Browse files Browse the repository at this point in the history
Fixes #463
  • Loading branch information
dandavison authored Dec 26, 2020
1 parent fba8df3 commit c5f82fe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit c5f82fe

Please # to comment.