fix: use SHELL environment variable instead of user database for shell meta plugin

Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-07-29 12:49:39 -03:00
parent 5d79fe8a82
commit 6bcabf4fb8

View File

@@ -195,18 +195,7 @@ impl MetaPlugin for ShellMetaPlugin {
fn finalize(&mut self) -> io::Result<String> { fn finalize(&mut self) -> io::Result<String> {
match env::var("SHELL") { match env::var("SHELL") {
Ok(shell) => Ok(shell), Ok(shell) => Ok(shell),
Err(_) => { Err(_) => Ok("unknown".to_string()),
// Try to get shell from passwd database using uid
match uzers::get_user_by_uid(get_current_uid()) {
Some(user) => {
match user.shell().to_str() {
Some(shell) => Ok(shell.to_string()),
None => Ok("unknown".to_string()),
}
},
None => Ok("unknown".to_string()),
}
}
} }
} }