Skip to content

Commit

Permalink
Ignore ctrl-c (SIGINT) to avoid leaving an orphaned pager process. (#686
Browse files Browse the repository at this point in the history
)

Fixes #681
  • Loading branch information
dandavison committed Aug 12, 2021
1 parent 362f75e commit 223b2c6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
37 changes: 35 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bitflags = "1.3.1"
box_drawing = "0.1.2"
bytelines = "2.2.2"
console = "0.14.1"
ctrlc = "3.2.0"
dirs-next = "2.0.0"
grep-cli = "0.1.6"
itertools = "0.10.1"
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ fn run_app() -> std::io::Result<i32> {

#[cfg(not(tarpaulin_include))]
fn main() -> std::io::Result<()> {
// Ignore ctrl-c (SIGINT) to avoid leaving an orphaned pager process.
// See https://github.com/dandavison/delta/issues/681
ctrlc::set_handler(|| {})
.unwrap_or_else(|err| eprintln!("Failed to set ctrl-c handler: {}", err));
let exit_code = run_app()?;
// when you call process::exit, no destructors are called, so we want to do it only once, here
process::exit(exit_code);
Expand Down

0 comments on commit 223b2c6

Please sign in to comment.