From be3f2dbe26cf2eddef18da3842f82d57356bd439 Mon Sep 17 00:00:00 2001 From: James Rhodes Date: Wed, 22 May 2024 09:57:05 +0100 Subject: [PATCH] Switch to env::args for establishing the executable name Signed-off-by: James Rhodes --- plugins/c8y_remote_access_plugin/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/c8y_remote_access_plugin/src/lib.rs b/plugins/c8y_remote_access_plugin/src/lib.rs index 75189c584a9..504dbd95caf 100644 --- a/plugins/c8y_remote_access_plugin/src/lib.rs +++ b/plugins/c8y_remote_access_plugin/src/lib.rs @@ -93,9 +93,9 @@ static SUCCESS_MESSAGE: &str = "CONNECTED"; struct Unreachable(#[source] E, &'static str); async fn spawn_child(command: String, config_dir: &Utf8Path) -> miette::Result<()> { - let exec_path = std::env::current_exe() - .into_diagnostic() - .with_context(|| "Could not get current process executable")?; + let exec_path = std::env::args() + .next() + .ok_or(miette!("Could not get current process executable"))?; let mut command = tokio::process::Command::new(exec_path) .args(["--config-dir", config_dir.as_str()])