fix: remove invalid import and use proper uzers API
Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -6,7 +6,7 @@ use std::io;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::process;
|
use std::process;
|
||||||
use uzers::{get_current_uid, get_current_gid, get_current_username, get_current_groupname, get_current_user};
|
use uzers::{get_current_uid, get_current_gid, get_current_username, get_current_groupname};
|
||||||
|
|
||||||
use crate::meta_plugin::MetaPlugin;
|
use crate::meta_plugin::MetaPlugin;
|
||||||
|
|
||||||
@@ -196,7 +196,8 @@ impl MetaPlugin for ShellMetaPlugin {
|
|||||||
match env::var("SHELL") {
|
match env::var("SHELL") {
|
||||||
Ok(shell) => Ok(shell),
|
Ok(shell) => Ok(shell),
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
match get_current_user() {
|
// Try to get shell from passwd database using uid
|
||||||
|
match uzers::get_user_by_uid(get_current_uid()) {
|
||||||
Some(user) => {
|
Some(user) => {
|
||||||
match user.shell().to_str() {
|
match user.shell().to_str() {
|
||||||
Some(shell) => Ok(shell.to_string()),
|
Some(shell) => Ok(shell.to_string()),
|
||||||
|
|||||||
Reference in New Issue
Block a user