diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-03-04 15:32:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 15:32:49 -0500 |
commit | 9d8e5d6394f033f1bbd4603ae5becb3d3cad2006 (patch) | |
tree | f05659801d99fad8dbcb2675d578fca37957ed8c | |
parent | 5de4b05718a898b60af19e982952d7b3d78ba4d5 (diff) |
Exit if it looks like starting the pager process would never terminate (#531)
Fixes #529
Ref #378
-rw-r--r-- | src/bat_utils/output.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bat_utils/output.rs b/src/bat_utils/output.rs index eef00cd5..79b33bd4 100644 --- a/src/bat_utils/output.rs +++ b/src/bat_utils/output.rs @@ -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 |