From 81670e21f9f63bd3296725c4e2efe5d2a4d58ef7 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sat, 30 Nov 2024 07:16:24 +0000 Subject: [PATCH] fix: executing with sudo --- src/bin/dive.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/dive.rs b/src/bin/dive.rs index 7153149..ba4b459 100644 --- a/src/bin/dive.rs +++ b/src/bin/dive.rs @@ -85,6 +85,7 @@ fn reexec_with_sudo( let self_exe = read_link("/proc/self/exe")?; let loglevel = std::env::var("LOGLEVEL").unwrap_or_default(); Err(Command::new("sudo") + .arg("_WITH_SUDO=1") .args([ format!("LOGLEVEL={}", loglevel), format!("{}={}", ENV_LEAD_PID, lead_pid), @@ -97,7 +98,7 @@ fn reexec_with_sudo( } fn runs_with_sudo() -> bool { - std::env::var("SUDO_UID").is_ok() + std::env::var("_WITH_SUDO").is_ok() } fn prepare_shell_environment(