Skip to content

Commit

Permalink
Add on_log_quit.
Browse files Browse the repository at this point in the history
  • Loading branch information
guilt committed Feb 17, 2021
1 parent 90c8401 commit 9e7c459
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bin/rustup-init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -42,6 +47,10 @@ fn main() {
}

fn run_rustup() -> Result<utils::ExitCode> {
#[cfg(feature = "rt")]
{
let _ = rt::at_exit(log::on_quit_log);
}
if let Ok(dir) = process().var("RUSTUP_TRACE_DIR") {
open_trace_file!(dir)?;
}
Expand Down
5 changes: 5 additions & 0 deletions src/cli/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9e7c459

Please sign in to comment.