debug log

This commit is contained in:
zjp 2023-05-13 22:41:02 +08:00
parent 25792db877
commit b9283f6718
6 changed files with 21 additions and 17 deletions

View file

@ -41,9 +41,10 @@ fn prompt_finder(
}
}
let child = shell::out()
.stdout(Stdio::piped())
.arg(suggestion_command)
let mut cmd = shell::out();
cmd.stdout(Stdio::piped()).arg(suggestion_command);
debug!(cmd = ?cmd);
let child = cmd
.spawn()
.map_err(|e| ShellSpawnError::new(suggestion_command, e))?;
@ -236,9 +237,10 @@ pub fn act(
clipboard::copy(interpolated_snippet)?;
}
_ => {
shell::out()
.arg(&interpolated_snippet[..])
.spawn()
let mut cmd = shell::out();
cmd.arg(&interpolated_snippet[..]);
debug!(cmd = ?cmd);
cmd.spawn()
.map_err(|e| ShellSpawnError::new(&interpolated_snippet[..], e))?
.wait()
.context("bash was not running")?;

View file

@ -13,6 +13,7 @@ use crate::welcome;
pub fn init(fetcher: Box<dyn Fetcher>) -> Result<()> {
let config = &CONFIG;
let opts = FinderOpts::snippet_default();
debug!("opts = {opts:#?}");
// let fetcher = config.fetcher();
let (raw_selection, (variables, files)) = config
@ -32,6 +33,7 @@ pub fn init(fetcher: Box<dyn Fetcher>) -> Result<()> {
})
.context("Failed getting selection and variables from finder")?;
debug!(raw_selection = ?raw_selection);
let extractions = deser::terminal::read(&raw_selection, config.best_match());
if extractions.is_err() {
@ -45,7 +47,7 @@ pub fn init(fetcher: Box<dyn Fetcher>) -> Result<()> {
pub fn get_fetcher() -> Result<Box<dyn Fetcher>> {
let source = CONFIG.source();
debug!("{source:#?}");
debug!(source = ?source);
match source {
Source::Cheats(query) => {
let lines = cheatsh::call(&query)?;

View file

@ -30,11 +30,10 @@ impl Runnable for Input {
if !extra.is_empty() {
print!("");
shell::out()
.arg(extra)
.spawn()
.map_err(|e| ShellSpawnError::new(extra, e))?
.wait()?;
let mut cmd = shell::out();
cmd.arg(extra);
debug!(?cmd);
cmd.spawn().map_err(|e| ShellSpawnError::new(extra, e))?.wait()?;
}
}

View file

@ -42,6 +42,5 @@ pub fn out() -> Command {
cmd.args(words);
let dash_c = if words_str.contains("cmd.exe") { "/c" } else { "-c" };
cmd.arg(dash_c);
debug!("shell cmd = `{cmd:#?}`");
cmd
}

View file

@ -190,7 +190,7 @@ impl fetcher::Fetcher for Fetcher {
}
}
debug!("{self:#?}");
debug!("FilesystemFetcher = {self:#?}");
Ok(found_something)
}

View file

@ -152,11 +152,13 @@ impl FinderChoice {
});
}
let child = command
command
.env("SHELL", CONFIG.finder_shell())
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.spawn();
.stdout(Stdio::piped());
debug!(cmd = ?command);
let child = command.spawn();
let mut child = match child {
Ok(x) => x,