Skip to content

Commit

Permalink
[windows] skip window creation on auth exec (#1095)
Browse files Browse the repository at this point in the history
* don't create a window for auth exec

Signed-off-by: goenning <me@goenning.net>

* rust fmt

Signed-off-by: goenning <me@goenning.net>

* move it close to other imports

Signed-off-by: goenning <me@goenning.net>

* Update kube-client/src/client/auth/mod.rs

Co-authored-by: kazk <kazk.dev@gmail.com>
Signed-off-by: Guilherme Oenning <me@goenning.net>

Signed-off-by: goenning <me@goenning.net>
Signed-off-by: Guilherme Oenning <me@goenning.net>
Co-authored-by: kazk <kazk.dev@gmail.com>
Co-authored-by: Eirik A <sszynrae@gmail.com>
  • Loading branch information
3 people authored Dec 6, 2022
1 parent be05e7c commit e8fdf08
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kube-client/src/client/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{
sync::Arc,
};


use chrono::{DateTime, Duration, Utc};
use futures::future::BoxFuture;
use http::{
Expand All @@ -21,6 +22,7 @@ use crate::config::{AuthInfo, AuthProviderConfig, ExecConfig};

#[cfg(feature = "oauth")] mod oauth;
#[cfg(feature = "oauth")] pub use oauth::Error as OAuthError;
#[cfg(target_os = "windows")] use std::os::windows::process::CommandExt;

#[derive(Error, Debug)]
/// Client auth errors
Expand Down Expand Up @@ -504,6 +506,12 @@ fn auth_exec(auth: &ExecConfig) -> Result<ExecCredential, Error> {
}
}

#[cfg(target_os = "windows")]
{
const CREATE_NO_WINDOW: u32 = 0x08000000;
cmd.creation_flags(CREATE_NO_WINDOW);
}

let out = cmd.output().map_err(Error::AuthExecStart)?;
if !out.status.success() {
return Err(Error::AuthExecRun {
Expand Down

0 comments on commit e8fdf08

Please sign in to comment.