Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Jun 5, 2024
1 parent e4fc3b7 commit fec5307
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/bin/rustup-init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#![recursion_limit = "1024"]

use std::env;

use anyhow::{anyhow, Context, Result};
use cfg_if::cfg_if;
// Public macros require availability of the internal symbols
Expand Down Expand Up @@ -116,9 +118,7 @@ async fn run_rustup_inner() -> Result<utils::ExitCode> {

// Before we do anything else, ensure we know where we are and who we
// are because otherwise we cannot proceed usefully.
let current_dir = process()
.current_dir()
.context(RustupError::LocatingWorkingDir)?;
let current_dir = env::current_dir().context(RustupError::LocatingWorkingDir)?;
utils::current_exe()?;

match process().name().as_deref() {
Expand Down
8 changes: 0 additions & 8 deletions src/currentprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@ impl Process {
}
}

pub fn current_dir(&self) -> io::Result<PathBuf> {
match self {
Process::OSProcess(_) => env::current_dir(),
#[cfg(feature = "test")]
Process::TestProcess(p) => Ok(p.cwd.clone()),
}
}

#[cfg(test)]
fn id(&self) -> u64 {
match self {
Expand Down
3 changes: 3 additions & 0 deletions src/test/mock/clitools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,18 +725,21 @@ impl Config {
.into_boxed_str(),
);
}
dbg!("create test process");
let tp = currentprocess::TestProcess::new(&*self.workdir.borrow(), &arg_strings, vars, "");
let mut builder = Builder::new_multi_thread();
builder
.enable_all()
.worker_threads(2)
.max_blocking_threads(2);
dbg!("run test process");
let process_res =
currentprocess::with_runtime(tp.clone().into(), builder, rustup_mode::main(tp.cwd.clone()));
// convert Err's into an ec
let ec = match process_res {
Ok(process_res) => process_res,
Err(e) => {
dbg!("handle error");
currentprocess::with(tp.clone().into(), || crate::cli::common::report_error(&e));
utils::ExitCode(1)
}
Expand Down

0 comments on commit fec5307

Please sign in to comment.