that should do the job

This commit is contained in:
Robin Müller 2024-04-25 17:11:52 +02:00
parent eea2f76b9f
commit b4a84dbf20
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -23,9 +23,9 @@ use ops_sat_rs::config::{
use crate::requests::CompositeRequest; use crate::requests::CompositeRequest;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct ShellCmd { pub struct ShellCmd<'a> {
cmd: String, cmd: &'a str,
args: Vec<String>, args: Vec<&'a str>,
} }
#[derive(Debug, Clone, Copy, TryFromPrimitive)] #[derive(Debug, Clone, Copy, TryFromPrimitive)]
@ -231,10 +231,12 @@ mod tests {
let mut exp_ctrl = let mut exp_ctrl =
ExperimentController::new(composite_req_rx, action_reply_tx, stop_signal); ExperimentController::new(composite_req_rx, action_reply_tx, stop_signal);
let named_temp_file = NamedTempFile::new().expect("creating temp file failed"); let named_temp_file = NamedTempFile::new().expect("creating temp file failed");
let cmd = ShellCmd { let args = vec![named_temp_file
cmd: "rm".to_string(), .path()
args: vec![named_temp_file.path().to_string_lossy().to_string()], .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 cmd_serialized = serde_json::to_string(&cmd).expect("serialization failed");
let action_req = satrs::action::ActionRequest { let action_req = satrs::action::ActionRequest {
action_id: ActionId::ExecuteShellCommandBlocking as u32, action_id: ActionId::ExecuteShellCommandBlocking as u32,