Skip to content

Commit 9e7c459

Browse files
committed
Add on_log_quit.
1 parent 90c8401 commit 9e7c459

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/bin/rustup-init.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@
1313
//! different name.
1414
1515
#![recursion_limit = "1024"]
16+
#![feature(rt)]
1617

1718
use std::path::PathBuf;
19+
#[cfg(feature = "rt")]
20+
use std::rt;
1821

1922
use cfg_if::cfg_if;
2023
use rs_tracing::*;
2124

2225
use rustup::cli::common;
2326
use rustup::cli::errors::*;
27+
#[cfg(feature = "rt")]
28+
use rustup::cli::log;
2429
use rustup::cli::proxy_mode;
2530
use rustup::cli::rustup_mode;
2631
#[cfg(windows)]
@@ -42,6 +47,10 @@ fn main() {
4247
}
4348

4449
fn run_rustup() -> Result<utils::ExitCode> {
50+
#[cfg(feature = "rt")]
51+
{
52+
let _ = rt::at_exit(log::on_quit_log);
53+
}
4554
if let Ok(dir) = process().var("RUSTUP_TRACE_DIR") {
4655
open_trace_file!(dir)?;
4756
}

src/cli/log.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ macro_rules! debug {
2323
( $ ( $ arg : tt ) * ) => ( $crate::cli::log::debug_fmt ( format_args ! ( $ ( $ arg ) * ) ) )
2424
}
2525

26+
pub fn on_quit_log() {
27+
let mut t = term2::stderr();
28+
let _ = t.reset();
29+
}
30+
2631
pub fn warn_fmt(args: fmt::Arguments<'_>) {
2732
let mut t = term2::stderr();
2833
let _ = t.fg(term2::color::YELLOW);

0 commit comments

Comments
 (0)