Skip to content

Commit 25a74de

Browse files
committed
no need to forward all env vars
1 parent 69358d0 commit 25a74de

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

miri-script/src/commands.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::ops::Not;
66
use anyhow::{anyhow, bail, Context, Result};
77
use path_macro::path;
88
use walkdir::WalkDir;
9-
use xshell::cmd;
9+
use xshell::{cmd, Shell};
1010

1111
use crate::util::*;
1212
use crate::Command;
@@ -91,7 +91,7 @@ impl Command {
9191
// Make sure rustup-toolchain-install-master is installed.
9292
which::which("rustup-toolchain-install-master")
9393
.context("Please install rustup-toolchain-install-master by running 'cargo install rustup-toolchain-install-master'")?;
94-
let sh = shell()?;
94+
let sh = Shell::new()?;
9595
sh.change_dir(miri_dir()?);
9696
let new_commit = Some(sh.read_file("rust-version")?.trim().to_owned());
9797
let current_commit = {
@@ -130,7 +130,7 @@ impl Command {
130130
}
131131

132132
fn rustc_pull(commit: Option<String>) -> Result<()> {
133-
let sh = shell()?;
133+
let sh = Shell::new()?;
134134
sh.change_dir(miri_dir()?);
135135
let commit = commit.map(Result::Ok).unwrap_or_else(|| {
136136
let rust_repo_head =
@@ -177,7 +177,7 @@ impl Command {
177177
}
178178

179179
fn rustc_push(github_user: String, branch: String) -> Result<()> {
180-
let sh = shell()?;
180+
let sh = Shell::new()?;
181181
sh.change_dir(miri_dir()?);
182182
let base = sh.read_file("rust-version")?.trim().to_owned();
183183
// Make sure the repo is clean.
@@ -265,7 +265,7 @@ impl Command {
265265
let Some((command_name, trailing_args)) = command.split_first() else {
266266
bail!("expected many-seeds command to be non-empty");
267267
};
268-
let sh = shell()?;
268+
let sh = Shell::new()?;
269269
for seed in seed_start..seed_end {
270270
println!("Trying seed: {seed}");
271271
let mut miriflags = env::var_os("MIRIFLAGS").unwrap_or_default();
@@ -293,7 +293,7 @@ impl Command {
293293
// Make sure we have an up-to-date Miri installed and selected the right toolchain.
294294
Self::install(vec![])?;
295295

296-
let sh = shell()?;
296+
let sh = Shell::new()?;
297297
sh.change_dir(miri_dir()?);
298298
let benches_dir = "bench-cargo-miri";
299299
let benches = if benches.is_empty() {

miri-script/src/util.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,12 @@ pub fn miri_dir() -> std::io::Result<PathBuf> {
1313

1414
/// Queries the active toolchain for the Miri dir.
1515
pub fn active_toolchain() -> Result<String> {
16-
let sh = shell()?;
16+
let sh = Shell::new()?;
1717
sh.change_dir(miri_dir()?);
1818
let stdout = cmd!(sh, "rustup show active-toolchain").read()?;
1919
Ok(stdout.split_whitespace().next().context("Could not obtain active Rust toolchain")?.into())
2020
}
2121

22-
pub fn shell() -> Result<Shell> {
23-
let sh = Shell::new()?;
24-
// xshell does not propagate parent's env variables by default.
25-
for (k, v) in std::env::vars_os() {
26-
sh.set_var(k, v);
27-
}
28-
Ok(sh)
29-
}
30-
3122
pub fn flagsplit(flags: &str) -> Vec<String> {
3223
// This code is taken from `RUSTFLAGS` handling in cargo.
3324
flags.split(' ').map(str::trim).filter(|s| !s.is_empty()).map(str::to_string).collect()
@@ -50,7 +41,7 @@ pub struct MiriEnv {
5041
impl MiriEnv {
5142
pub fn new() -> Result<Self> {
5243
let toolchain = active_toolchain()?;
53-
let sh = shell()?; // we are preserving the current_dir on this one, so paths resolve properly!
44+
let sh = Shell::new()?; // we are preserving the current_dir on this one, so paths resolve properly!
5445
let miri_dir = miri_dir()?;
5546

5647
let sysroot = cmd!(sh, "rustc +{toolchain} --print sysroot").read()?.into();

0 commit comments

Comments
 (0)