(
&self,
session_id: &str,
command: String,
workdir: Option<String>,
)
| 413 | } |
| 414 | |
| 415 | pub fn execute_shell( |
| 416 | &self, |
| 417 | session_id: &str, |
| 418 | command: String, |
| 419 | workdir: Option<String>, |
| 420 | ) -> anyhow::Result<serde_json::Value> { |
| 421 | let url = format!("{}/session/{}/shell", self.base_url, session_id); |
| 422 | let request = ExecuteShellRequest { command, workdir }; |
| 423 | let response = self.client.post(&url).json(&request).send()?; |
| 424 | |
| 425 | if !response.status().is_success() { |
| 426 | let status = response.status(); |
| 427 | let text = response.text().unwrap_or_default(); |
| 428 | anyhow::bail!("Failed to execute shell command: {} - {}", status, text); |
| 429 | } |
| 430 | |
| 431 | Ok(response.json::<serde_json::Value>()?) |
| 432 | } |
| 433 | |
| 434 | pub fn abort_session(&self, session_id: &str) -> anyhow::Result<serde_json::Value> { |
| 435 | let url = format!("{}/session/{}/abort", self.base_url, session_id); |
no test coverage detected