Skip to content

Commit

Permalink
Properly accounts for behavior on windows systems
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Heath <[email protected]>
  • Loading branch information
jasonheath committed Sep 20, 2024
1 parent 2c7784d commit a6d58a1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions components/hab/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,25 @@ async fn main() {
env_logger::init();
let mut ui = UI::default_with_env();
let flags = FeatureFlag::from_env(&mut ui);

#[cfg(not(target_os = "windows"))]
if let Err(e) = posix_perm::set_umask_0022() {
ui.fatal(e).unwrap();
std::process::exit(1);
}

manage_permissions(&mut ui);
if let Err(e) = start(&mut ui, flags).await {
let exit_code = e.exit_code();
ui.fatal(e).unwrap();
std::process::exit(exit_code)
}
}

#[cfg(not(target_os = "windows"))]
fn manage_permissions(ui: &mut UI) {
if let Err(e) = posix_perm::set_umask_0022() {
ui.fatal(e).unwrap();
std::process::exit(1);
}
}

#[cfg(target_os = "windows")]
fn manage_permissions(ui: &mut UI) {}

#[allow(clippy::cognitive_complexity)]
async fn start(ui: &mut UI, feature_flags: FeatureFlag) -> Result<()> {
// We parse arguments with configopt in a separate thread to eliminate
Expand Down

0 comments on commit a6d58a1

Please sign in to comment.