summaryrefslogtreecommitdiffstats
path: root/src/util/process.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/process.rs')
-rw-r--r--src/util/process.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/util/process.rs b/src/util/process.rs
index 679239a..b333cea 100644
--- a/src/util/process.rs
+++ b/src/util/process.rs
@@ -58,11 +58,19 @@ where
command.args(entry.get_args());
command.args(paths);
- let _ = command.status()?;
+ if entry.get_pager() {
+ println!("{}", termion::clear::All);
+ let pager_env = std::env::var("PAGER").unwrap_or_else(|_| String::from("less"));
+ let pager_args: Vec<&str> = pager_env.split_whitespace().collect();
- if entry.get_confirm_exit() {
- wait_for_enter()?;
+ if let Some(child_stdout) = command.stdout(process::Stdio::piped()).spawn()?.stdout {
+ process::Command::new(pager_args[0])
+ .args(&pager_args[1..])
+ .stdin(child_stdout)
+ .status()?;
+ }
}
+ command.status()?;
Ok(())
}