mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-29 23:57:51 +00:00
cli: split pager arguments like ui.editor
Environment like $PAGER or $EDITOR is supposed to be executed via shell, so we need to at least split the command string.
This commit is contained in:
parent
f23302bc53
commit
3b5edd480c
1 changed files with 6 additions and 5 deletions
11
src/ui.rs
11
src/ui.rs
|
@ -14,13 +14,14 @@
|
|||
|
||||
use std::io::{Stderr, Stdout, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Child, ChildStdin, Command, Stdio};
|
||||
use std::process::{Child, ChildStdin, Stdio};
|
||||
use std::str::FromStr;
|
||||
use std::{fmt, io, mem};
|
||||
|
||||
use crossterm::tty::IsTty;
|
||||
use jujutsu_lib::settings::UserSettings;
|
||||
|
||||
use crate::config::FullCommandArgs;
|
||||
use crate::formatter::{Formatter, FormatterFactory};
|
||||
|
||||
pub struct Ui {
|
||||
|
@ -106,11 +107,11 @@ impl Default for PaginationChoice {
|
|||
}
|
||||
}
|
||||
|
||||
fn pager_setting(settings: &UserSettings) -> String {
|
||||
fn pager_setting(settings: &UserSettings) -> FullCommandArgs {
|
||||
settings
|
||||
.config()
|
||||
.get_string("ui.pager")
|
||||
.unwrap_or_else(|_| "less".to_string())
|
||||
.get("ui.pager")
|
||||
.unwrap_or_else(|_| "less".into())
|
||||
}
|
||||
|
||||
impl Ui {
|
||||
|
@ -350,7 +351,7 @@ impl UiOutput {
|
|||
|
||||
fn new_paged(settings: &UserSettings) -> io::Result<UiOutput> {
|
||||
let pager_cmd = pager_setting(settings);
|
||||
let mut child = Command::new(pager_cmd).stdin(Stdio::piped()).spawn()?;
|
||||
let mut child = pager_cmd.to_command().stdin(Stdio::piped()).spawn()?;
|
||||
let child_stdin = child.stdin.take().unwrap();
|
||||
Ok(UiOutput::Paged { child, child_stdin })
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue