Skip to main content

agent_procs/cli/
restart.rs

1use crate::protocol::{Request, Response};
2
3pub async fn execute(session: &str, target: &str) -> i32 {
4    let req = Request::Restart {
5        target: target.into(),
6    };
7    match crate::cli::request(session, &req, false).await {
8        Ok(Response::RunOk { name, id, pid }) => {
9            println!("restarted {} (id: {}, pid: {})", name, id, pid);
10            0
11        }
12        Ok(Response::Error { code, message }) => {
13            eprintln!("error: {}", message);
14            code
15        }
16        _ => 1,
17    }
18}