Skip to content

Commit

Permalink
Exit if it looks like starting the pager process would never terminate (
Browse files Browse the repository at this point in the history
#531)

Fixes #529
Ref #378
  • Loading branch information
dandavison authored Mar 4, 2021
1 parent 5de4b05 commit 9d8e5d6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/bat_utils/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ impl OutputType {
p.env("LESSCHARSET", "UTF-8");
p
} else {
if pager_path.file_stem() == Some(&OsString::from("delta")) {
eprintln!(
"\
It looks like you have set delta as the value of $PAGER. \
This would result in a non-terminating recursion. \
delta is not an appropriate value for $PAGER \
(but it is an appropriate value for $GIT_PAGER)."
);
std::process::exit(1);
}
let mut p = Command::new(&pager_path);
p.args(args);
p
Expand Down

0 comments on commit 9d8e5d6

Please sign in to comment.