From b4a84dbf20d4e0c78a389a9205ffa59ab5661a70 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Apr 2024 17:11:52 +0200 Subject: [PATCH] that should do the job --- src/controller.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/controller.rs b/src/controller.rs index b707f4e..57321d1 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -23,9 +23,9 @@ use ops_sat_rs::config::{ use crate::requests::CompositeRequest; #[derive(Serialize, Deserialize, Debug)] -pub struct ShellCmd { - cmd: String, - args: Vec, +pub struct ShellCmd<'a> { + cmd: &'a str, + args: Vec<&'a str>, } #[derive(Debug, Clone, Copy, TryFromPrimitive)] @@ -231,10 +231,12 @@ mod tests { let mut exp_ctrl = ExperimentController::new(composite_req_rx, action_reply_tx, stop_signal); let named_temp_file = NamedTempFile::new().expect("creating temp file failed"); - let cmd = ShellCmd { - cmd: "rm".to_string(), - args: vec![named_temp_file.path().to_string_lossy().to_string()], - }; + let args = vec![named_temp_file + .path() + .to_str() + .expect("converting path to str failed")]; + + let cmd = ShellCmd { cmd: "rm", args }; let cmd_serialized = serde_json::to_string(&cmd).expect("serialization failed"); let action_req = satrs::action::ActionRequest { action_id: ActionId::ExecuteShellCommandBlocking as u32,