(&self)
| 141 | } |
| 142 | |
| 143 | async fn close(&self) -> Result<(), McpClientError> { |
| 144 | let mut process_guard = self.process.lock().await; |
| 145 | if let Some(mut child) = process_guard.take() { |
| 146 | child.kill().await.map_err(|e| { |
| 147 | McpClientError::TransportError(format!("Failed to kill process: {}", e)) |
| 148 | })?; |
| 149 | } |
| 150 | let mut stdin_guard = self.stdin.lock().await; |
| 151 | *stdin_guard = None; |
| 152 | Ok(()) |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | // --------------------------------------------------------------------------- |