Skip to content

Commit

Permalink
Add --set-home to sudo invocation
Browse files Browse the repository at this point in the history
It is assumed that dirs::home_dir() refers to root's home directory, but
this is not the case when invoked on macOS.
  • Loading branch information
mkenigs committed Jan 19, 2024
1 parent 7cbb629 commit 2768aa5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ pub fn ensure_root() -> eyre::Result<()> {
.dimmed()
);
let sudo_cstring = CString::new("sudo").wrap_err("Making C string of `sudo`")?;
let set_home_cstring =
CString::new("--set-home").wrap_err("Making C string of `--set-home`")?;

let args = std::env::args();
let mut arg_vec_cstring = vec![];
arg_vec_cstring.push(sudo_cstring.clone());
arg_vec_cstring.push(set_home_cstring);

let mut env_list = vec![];
for (key, value) in std::env::vars() {
Expand Down

0 comments on commit 2768aa5

Please sign in to comment.