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:
@@ -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()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user