mirror of
https://github.com/ellie/atuin.git
synced 2024-10-27 07:40:53 +03: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'`
|
// Every shell we support handles `shell -c 'command'`
|
||||||
fn env_exists(shell: &str, var: &str) -> bool {
|
fn env_exists(shell: &str, var: &str) -> bool {
|
||||||
let mut cmd = Command::new(shell)
|
let cmd = Command::new(shell)
|
||||||
.args(["-ic", format!("echo ${var}").as_str()])
|
.args([
|
||||||
|
"-ic",
|
||||||
|
format!("[ -z ${var} ] || echo ATUIN_DOCTOR_ENV_FOUND").as_str(),
|
||||||
|
])
|
||||||
.output()
|
.output()
|
||||||
.map_or(String::new(), |v| {
|
.map_or(String::new(), |v| {
|
||||||
let out = v.stdout;
|
let out = v.stdout;
|
||||||
String::from_utf8(out).unwrap_or_default()
|
String::from_utf8(out).unwrap_or_default()
|
||||||
});
|
});
|
||||||
|
|
||||||
cmd.retain(|c| !c.is_whitespace());
|
cmd.contains("ATUIN_DOCTOR_ENV_FOUND")
|
||||||
|
|
||||||
!cmd.is_empty()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn plugins(shell: &str) -> Vec<String> {
|
pub fn plugins(shell: &str) -> Vec<String> {
|
||||||
|
Loading…
Reference in New Issue
Block a user