Skip to content

Commit

Permalink
fix commands with pager enabled capturing unwanted input
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiyaa committed Mar 23, 2024
1 parent 2a392e8 commit 2493c9d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/util/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ where
let pager_env = std::env::var("PAGER").unwrap_or_else(|_| String::from("less"));
let pager_args: Vec<&str> = pager_env.split_whitespace().collect();

if let Some(child_stdout) = command.stdout(process::Stdio::piped()).spawn()?.stdout {
if let Some(child_stdout) = command
.stdin(process::Stdio::null())
.stdout(process::Stdio::piped())
.spawn()?
.stdout
{
process::Command::new(pager_args[0])
.args(&pager_args[1..])
.stdin(child_stdout)
Expand Down

0 comments on commit 2493c9d

Please sign in to comment.