mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Update format
This commit is contained in:
@@ -129,7 +129,7 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
.wait_with_output()
|
||||
.await?;
|
||||
|
||||
let auth_result: SamlAuthResult = serde_json::from_slice(&output.stdout)
|
||||
let auth_result = serde_json::from_slice::<SamlAuthResult>(&output.stdout)
|
||||
.map_err(|_| anyhow::anyhow!("Failed to parse auth data"))?;
|
||||
|
||||
match auth_result {
|
||||
|
@@ -21,8 +21,7 @@ impl CommandExt for Command {
|
||||
}
|
||||
|
||||
fn into_non_root(mut self) -> anyhow::Result<Command> {
|
||||
let user =
|
||||
get_non_root_user().map_err(|_| anyhow::anyhow!("{:?} cannot be run as root", self))?;
|
||||
let user = get_non_root_user().map_err(|_| anyhow::anyhow!("{:?} cannot be run as root", self))?;
|
||||
|
||||
self
|
||||
.env("HOME", user.home_dir())
|
||||
@@ -42,8 +41,7 @@ fn get_non_root_user() -> anyhow::Result<User> {
|
||||
let user = if current_user == "root" {
|
||||
get_real_user()?
|
||||
} else {
|
||||
uzers::get_user_by_name(¤t_user)
|
||||
.ok_or_else(|| anyhow::anyhow!("User ({}) not found", current_user))?
|
||||
uzers::get_user_by_name(¤t_user).ok_or_else(|| anyhow::anyhow!("User ({}) not found", current_user))?
|
||||
};
|
||||
|
||||
if user.uid() == 0 {
|
||||
|
@@ -66,10 +66,7 @@ impl GuiLauncher {
|
||||
|
||||
let mut non_root_cmd = cmd.into_non_root()?;
|
||||
|
||||
let mut child = non_root_cmd
|
||||
.kill_on_drop(true)
|
||||
.stdin(Stdio::piped())
|
||||
.spawn()?;
|
||||
let mut child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn()?;
|
||||
|
||||
let mut stdin = child
|
||||
.stdin
|
||||
|
Reference in New Issue
Block a user