From 2768aa5f07c6fa5674e19c62150eaf2a027b8afb Mon Sep 17 00:00:00 2001 From: Matthew Kenigsberg Date: Fri, 19 Jan 2024 15:07:24 -0700 Subject: [PATCH] Add --set-home to sudo invocation It is assumed that dirs::home_dir() refers to root's home directory, but this is not the case when invoked on macOS. --- src/cli/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 37ded7302..3738daf50 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -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() {