diff --git a/src/bin/rustup-init.rs b/src/bin/rustup-init.rs index 09b125b87c..70f1830fd4 100644 --- a/src/bin/rustup-init.rs +++ b/src/bin/rustup-init.rs @@ -13,14 +13,19 @@ //! different name. #![recursion_limit = "1024"] +#![feature(rt)] use std::path::PathBuf; +#[cfg(feature = "rt")] +use std::rt; use cfg_if::cfg_if; use rs_tracing::*; use rustup::cli::common; use rustup::cli::errors::*; +#[cfg(feature = "rt")] +use rustup::cli::log; use rustup::cli::proxy_mode; use rustup::cli::rustup_mode; #[cfg(windows)] @@ -42,6 +47,10 @@ fn main() { } fn run_rustup() -> Result { + #[cfg(feature = "rt")] + { + let _ = rt::at_exit(log::on_quit_log); + } if let Ok(dir) = process().var("RUSTUP_TRACE_DIR") { open_trace_file!(dir)?; } diff --git a/src/cli/log.rs b/src/cli/log.rs index 0f23c78c5d..e1faf9fbcc 100644 --- a/src/cli/log.rs +++ b/src/cli/log.rs @@ -23,6 +23,11 @@ macro_rules! debug { ( $ ( $ arg : tt ) * ) => ( $crate::cli::log::debug_fmt ( format_args ! ( $ ( $ arg ) * ) ) ) } +pub fn on_quit_log() { + let mut t = term2::stderr(); + let _ = t.reset(); +} + pub fn warn_fmt(args: fmt::Arguments<'_>) { let mut t = term2::stderr(); let _ = t.fg(term2::color::YELLOW);