Skip to content

Commit a3d6797

Browse files
authored
Merge pull request #2123 from kinnison/kinnison/cleanup-no-cwd-message
Improve the reporting when CWD is invalid
2 parents d8b81c7 + fdec924 commit a3d6797

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/cli/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ mod topical_doc;
3131

3232
use crate::errors::*;
3333
use rustup::env_var::RUST_RECURSION_COUNT_MAX;
34+
use rustup::utils::utils;
3435

3536
use std::env;
3637
use std::path::PathBuf;
@@ -60,6 +61,11 @@ fn run_rustup_inner() -> Result<()> {
6061
// bugs in rustup.
6162
do_recursion_guard()?;
6263

64+
// Before we do anything else, ensure we know where we are and who we
65+
// are because otherwise we cannot proceed usefully.
66+
utils::current_dir()?;
67+
utils::current_exe()?;
68+
6369
// The name of arg0 determines how the program is going to behave
6470
let arg0 = match env::var("RUSTUP_FORCE_ARG0") {
6571
Ok(v) => Some(v),

src/errors.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ error_chain! {
3232

3333
errors {
3434
LocatingWorkingDir {
35-
description("could not locate working directory")
35+
description("Unable to proceed. Could not locate working directory.")
3636
}
3737
ReadingFile {
3838
name: &'static str,
@@ -177,9 +177,6 @@ error_chain! {
177177
description("failed to set permissions")
178178
display("failed to set permissions for '{}'", path.display())
179179
}
180-
GettingCwd {
181-
description("couldn't get current working directory")
182-
}
183180
CargoHome {
184181
description("couldn't find value of CARGO_HOME")
185182
}

0 commit comments

Comments
 (0)