rsiot/components/cmp_os_process/
fn_process.rs1use std::time::Duration;
2
3use tokio::process::Command;
4use tokio::time::sleep;
5
6use crate::{executor::CmpInOut, message::MsgDataBound};
7
8use super::Config;
9
10pub async fn fn_process<TMsg>(_config: Config<TMsg>, _msg_bus: CmpInOut<TMsg>) -> super::Result<()>
11where
12 TMsg: MsgDataBound,
13{
14 loop {
15 let output = Command::new("echo").arg("hello").arg("world").output();
16
17 let output = output.await.unwrap();
18
19 println!("Status: {}", output.status.success());
20 println!("Stdout: {:?}", output.stdout);
21
22 sleep(Duration::from_secs(2)).await;
23 }
24}