diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 4c92cfab6f..e7682d1be1 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -1,7 +1,6 @@ use std::fmt; use std::io::Write; use std::path::{Path, PathBuf}; -use std::process; use std::str::FromStr; use anyhow::{anyhow, Error, Result}; @@ -24,7 +23,6 @@ use crate::{ currentprocess::{ argsource::ArgSource, filesource::{StderrSource, StdoutSource}, - varsource::VarSource, }, dist::{ dist::{PartialToolchainDesc, Profile, TargetTriple}, @@ -212,6 +210,7 @@ pub fn main() -> Result { ("run", m) => run(cfg, m)?, ("which", m) => which(cfg, m)?, ("doc", m) => doc(cfg, m)?, + #[cfg(not(windows))] ("man", m) => man(cfg, m)?, ("self", c) => match c.subcommand() { Some(s) => match s { @@ -1615,7 +1614,10 @@ fn doc(cfg: &Cfg, m: &ArgMatches) -> Result { } } +#[cfg(not(windows))] fn man(cfg: &Cfg, m: &ArgMatches) -> Result { + use crate::currentprocess::varsource::VarSource; + let command = m.get_one::("command").unwrap(); let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; @@ -1629,7 +1631,7 @@ fn man(cfg: &Cfg, m: &ArgMatches) -> Result { if let Some(path) = process().var_os("MANPATH") { manpaths.push(path); } - process::Command::new("man") + std::process::Command::new("man") .env("MANPATH", manpaths) .arg(command) .status() diff --git a/src/dist/dist.rs b/src/dist/dist.rs index aca41172d9..eb96e5094f 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -1,8 +1,7 @@ use std::collections::HashSet; use std::env; use std::fmt; -use std::fs; -use std::io::{self, Read, Write}; +use std::io::Write; use std::ops::Deref; use std::path::Path; use std::str::FromStr; @@ -238,10 +237,13 @@ impl Deref for TargetTriple { } } +/// Check if /bin/sh is a 32-bit binary. If it doesn't exist, fall back to +/// checking if _we_ are a 32-bit binary. +/// rustup-init.sh also relies on checking /bin/sh for bitness. +#[cfg(not(windows))] fn is_32bit_userspace() -> bool { - // Check if /bin/sh is a 32-bit binary. If it doesn't exist, fall back to - // checking if _we_ are a 32-bit binary. - // rustup-init.sh also relies on checking /bin/sh for bitness. + use std::fs; + use std::io::{self, Read}; // inner function is to simplify error handling. fn inner() -> io::Result {