Fix windows build (#6774)

This commit is contained in:
Michael Vines 2019-11-06 16:07:28 -07:00 committed by GitHub
parent 65de227520
commit 2491719f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 18 deletions

View File

@ -533,6 +533,9 @@ pub fn main() {
option_env!("CI_COMMIT").unwrap_or("unknown") option_env!("CI_COMMIT").unwrap_or("unknown")
); );
let _log_redirect = {
#[cfg(unix)]
{
let default_logfile = format!( let default_logfile = format!(
"solana-validator-{}-{}.log", "solana-validator-{}-{}.log",
identity_keypair.pubkey(), identity_keypair.pubkey(),
@ -540,11 +543,9 @@ pub fn main() {
); );
let logfile = matches.value_of("logfile").unwrap_or(&default_logfile); let logfile = matches.value_of("logfile").unwrap_or(&default_logfile);
let _log_redirect = if logfile == "-" { if logfile == "-" {
None None
} else { } else {
#[cfg(unix)]
{
println!("log file: {}", logfile); println!("log file: {}", logfile);
Some(gag::Redirect::stderr(File::create(logfile).unwrap_or_else( Some(gag::Redirect::stderr(File::create(logfile).unwrap_or_else(
|err| { |err| {
@ -553,10 +554,11 @@ pub fn main() {
}, },
))) )))
} }
}
#[cfg(not(unix))] #[cfg(not(unix))]
{ {
println!("logging to a file is not supported on this platform"); println!("logging to a file is not supported on this platform");
None ()
} }
}; };