mirror of
https://github.com/atuinsh/atuin.git
synced 2025-03-14 06:59:10 +01:00
fix(doctor): use a different method to detect env vars (#1819)
This commit is contained in:
parent
ede5a5febf
commit
b1155873dd
@ -25,17 +25,18 @@ impl ShellInfo {
|
||||
//
|
||||
// Every shell we support handles `shell -c 'command'`
|
||||
fn env_exists(shell: &str, var: &str) -> bool {
|
||||
let mut cmd = Command::new(shell)
|
||||
.args(["-ic", format!("echo ${var}").as_str()])
|
||||
let cmd = Command::new(shell)
|
||||
.args([
|
||||
"-ic",
|
||||
format!("[ -z ${var} ] || echo ATUIN_DOCTOR_ENV_FOUND").as_str(),
|
||||
])
|
||||
.output()
|
||||
.map_or(String::new(), |v| {
|
||||
let out = v.stdout;
|
||||
String::from_utf8(out).unwrap_or_default()
|
||||
});
|
||||
|
||||
cmd.retain(|c| !c.is_whitespace());
|
||||
|
||||
!cmd.is_empty()
|
||||
cmd.contains("ATUIN_DOCTOR_ENV_FOUND")
|
||||
}
|
||||
|
||||
pub fn plugins(shell: &str) -> Vec<String> {
|
||||
|
Loading…
Reference in New Issue
Block a user