Skip to content

Commit

Permalink
Rollup merge of #81519 - jyn514:rustup-toolchain, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Don't print error output from rustup when detecting default build triple

Before, it could print this error if no toolchain was configured:

```
error: no default toolchain configured
error: backtrace:
error: stack backtrace:
   0: error_chain::backtrace::imp::InternalBacktrace::new
   1: rustup::config::Cfg::toolchain_for_dir
   2: rustup_init::run_rustup_inner
   3: rustup_init::main
   4: std::rt::lang_start::{{closure}}
   5: main
   6: __libc_start_main
   7: _start
```
  • Loading branch information
JohnTitor authored Jan 30, 2021
2 parents 5df611c + 807b5f5 commit e3905aa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ def default_build_triple(verbose):
# being detected as GNU instead of MSVC.
default_encoding = sys.getdefaultencoding()
try:
version = subprocess.check_output(["rustc", "--version", "--verbose"])
version = subprocess.check_output(["rustc", "--version", "--verbose"],
stderr=subprocess.DEVNULL)
version = version.decode(default_encoding)
host = next(x for x in version.split('\n') if x.startswith("host: "))
triple = host.split("host: ")[1]
Expand Down

0 comments on commit e3905aa

Please sign in to comment.