From 583ffd5f52abd2143768628388a7ef7d9c235194 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Tue, 30 Jul 2019 11:45:58 +0200 Subject: [PATCH] Disable non-panic error backtraces when RUSTUP_NO_BACKTRACE is set --- README.md | 3 +++ src/cli/common.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 448a18016c..478b9eab82 100644 --- a/README.md +++ b/README.md @@ -637,6 +637,9 @@ Command | Description - `RUSTUP_UNPACK_RAM` *unstable* (default 400M, min 100M) Caps the amount of RAM rustup will use for IO tasks while unpacking. +- `RUSTUP_NO_BACKTRACE` + Disables backtraces on non-panic errors even when `RUST_BACKTRACE` is set. + ## Other installation methods The primary installation method, as described at https://rustup.rs, differs by platform: diff --git a/src/cli/common.rs b/src/cli/common.rs index e56a5fb5c5..359d9fe6e6 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -536,6 +536,10 @@ pub fn report_error(e: &Error) { } fn show_backtrace() -> bool { + if let Ok(true) = env::var("RUSTUP_NO_BACKTRACE").map(|s| s == "1") { + return false; + } + if let Ok(true) = env::var("RUST_BACKTRACE").map(|s| s == "1") { return true; }