aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_env/src/lib.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_env/src/lib.rs b/crates/ra_env/src/lib.rs
index a1c4239be..4f94bffde 100644
--- a/crates/ra_env/src/lib.rs
+++ b/crates/ra_env/src/lib.rs
@@ -2,7 +2,7 @@
2//! [`get_path_for_executable`](fn.get_path_for_executable.html). 2//! [`get_path_for_executable`](fn.get_path_for_executable.html).
3//! See docs there for more information. 3//! See docs there for more information.
4 4
5use anyhow::{Error, Result}; 5use anyhow::{bail, Result};
6use std::env; 6use std::env;
7use std::path::{Path, PathBuf}; 7use std::path::{Path, PathBuf};
8use std::process::Command; 8use std::process::Command;
@@ -27,10 +27,10 @@ pub fn get_path_for_executable(executable_name: impl AsRef<str>) -> Result<PathB
27 if is_valid_executable(&path) { 27 if is_valid_executable(&path) {
28 Ok(path.into()) 28 Ok(path.into())
29 } else { 29 } else {
30 Err(Error::msg(format!( 30 bail!(
31 "`{}` environment variable points to something that's not a valid executable", 31 "`{}` environment variable points to something that's not a valid executable",
32 env_var 32 env_var
33 ))) 33 )
34 } 34 }
35 } else { 35 } else {
36 if is_valid_executable(executable_name) { 36 if is_valid_executable(executable_name) {
@@ -50,7 +50,10 @@ pub fn get_path_for_executable(executable_name: impl AsRef<str>) -> Result<PathB
50 // to inherit environment variables including $PATH, $CARGO, $RUSTC, etc from that terminal; 50 // to inherit environment variables including $PATH, $CARGO, $RUSTC, etc from that terminal;
51 // but launching VSCode from Dock does not inherit environment variables from a terminal. 51 // but launching VSCode from Dock does not inherit environment variables from a terminal.
52 // For more discussion, see #3118. 52 // For more discussion, see #3118.
53 Err(Error::msg(format!("Failed to find `{}` executable. Make sure `{}` is in `$PATH`, or set `${}` to point to a valid executable.", executable_name, executable_name, env_var))) 53 bail!(
54 "Failed to find `{}` executable. Make sure `{}` is in `$PATH`, or set `${}` to point to a valid executable.",
55 executable_name, executable_name, env_var
56 )
54 } 57 }
55} 58}
56 59