Skip to content

Commit

Permalink
Merge pull request #218 from Luap99/env
Browse files Browse the repository at this point in the history
set RUST_LOG for aardvark and keep aardvark stderr open with debug log level
  • Loading branch information
openshift-merge-robot authored Feb 10, 2022
2 parents 46d949d + adfb233 commit 6d59e4e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/dns/aardvark.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::network::types;
use log::log_enabled;
use nix::sys::signal::{self, Signal};
use nix::unistd::Pid;
use std::collections::HashMap;
Expand All @@ -9,6 +10,7 @@ use std::io::prelude::*;
use std::io::Result;
use std::net::IpAddr;
use std::net::Ipv4Addr;
use std::os::unix::prelude::FromRawFd;
use std::path::Path;
use std::process::{Command, Stdio};

Expand Down Expand Up @@ -100,10 +102,17 @@ impl Aardvark {

log::debug!("start aardvark-dns: {:?}", aardvark_args);

let output = match log_enabled!(log::Level::Debug) {
true => Stdio::null(),
false => unsafe { Stdio::from_raw_fd(2) },
};

Command::new(&aardvark_args[0])
.args(&aardvark_args[1..])
.stdout(Stdio::null())
.stderr(Stdio::null())
.stderr(output)
// set RUST_LOG for aardvark
.env("RUST_LOG", log::max_level().as_str())
.spawn()?;

Ok(())
Expand Down

0 comments on commit 6d59e4e

Please sign in to comment.