summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzjp <jiping_zhou@foxmail.com>2023-05-13 22:41:02 +0800
committerDenis Isidoro <denis.isidoro@uber.com>2023-12-10 06:26:34 -0300
commit6a0accface7e0abcfd91184ea13726b15e432dbc (patch)
tree3041921ea773f25495a992fb7f9bf7d46011c8b1
parent2f175e6eb23162d3e93f626b5c8a1659ef285b4a (diff)
debug log
-rw-r--r--src/commands/core/actor.rs14
-rw-r--r--src/commands/core/mod.rs4
-rwxr-xr-xsrc/commands/preview/var_stdin.rs9
-rw-r--r--src/common/shell.rs1
-rw-r--r--src/filesystem.rs2
-rw-r--r--src/finder/mod.rs8
6 files changed, 21 insertions, 17 deletions
diff --git a/src/commands/core/actor.rs b/src/commands/core/actor.rs
index 9d49717..91a1846 100644
--- a/src/commands/core/actor.rs
+++ b/src/commands/core/actor.rs
@@ -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")?;
diff --git a/src/commands/core/mod.rs b/src/commands/core/mod.rs
index 8055125..00e3a35 100644
--- a/src/commands/core/mod.rs
+++ b/src/commands/core/mod.rs
@@ -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)?;
diff --git a/src/commands/preview/var_stdin.rs b/src/commands/preview/var_stdin.rs
index 4b8ddfb..78cc8ef 100755
--- a/src/commands/preview/var_stdin.rs
+++ b/src/commands/preview/var_stdin.rs
@@ -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()?;
}
}
diff --git a/src/common/shell.rs b/src/common/shell.rs
index 976128b..331eb32 100644
--- a/src/common/shell.rs
+++ b/src/common/shell.rs
@@ -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
}
diff --git a/src/filesystem.rs b/src/filesystem.rs
index a53f246..b8c4a03 100644
--- a/src/filesystem.rs
+++ b/src/filesystem.rs
@@ -190,7 +190,7 @@ impl fetcher::Fetcher for Fetcher {
}
}
- debug!("{self:#?}");
+ debug!("FilesystemFetcher = {self:#?}");
Ok(found_something)
}
diff --git a/src/finder/mod.rs b/src/finder/mod.rs
index b18888f..9b4ccfd 100644
--- a/src/finder/mod.rs
+++ b/src/finder/mod.rs
@@ -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,