Skip to content

Commit

Permalink
[fix] don't override global RUST_LOG variable
Browse files Browse the repository at this point in the history
Overriding the RUST_LOG variable means it propagates to rust programs
spawned by swhks, directly and indirectly.
  • Loading branch information
mendess authored and Shinyzenith committed Oct 16, 2023
1 parent 1116772 commit 30f25b5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions swhks/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ use std::{
use sysinfo::{ProcessExt, System, SystemExt};

fn main() -> std::io::Result<()> {
env::set_var("RUST_LOG", "swhks=warn");

let app = clap::Command::new("swhks")
.version(env!("CARGO_PKG_VERSION"))
.author(env!("CARGO_PKG_AUTHORS"))
Expand All @@ -30,11 +28,13 @@ fn main() -> std::io::Result<()> {
));
let args = app.get_matches();
if args.is_present("debug") {
env::set_var("RUST_LOG", "swhks=trace");
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("swhks=trace"))
.init();
} else {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("swhks=warn"))
.init();
}

env_logger::init();

log::trace!("Setting process umask.");
umask(Mode::S_IWGRP | Mode::S_IWOTH);

Expand Down

0 comments on commit 30f25b5

Please sign in to comment.