MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / execute_shell

Method execute_shell

crates/opencode-tui/src/api.rs:415–432  ·  view source on GitHub ↗
(
        &self,
        session_id: &str,
        command: String,
        workdir: Option<String>,
    )

Source from the content-addressed store, hash-verified

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);

Callers 1

submit_shell_commandMethod · 0.80

Calls 3

sendMethod · 0.45
statusMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected