MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / update_session

Method update_session

crates/opencode-server/src/pty.rs:191–210  ·  view source on GitHub ↗
(
        &self,
        id: &str,
        command: Option<&str>,
        cwd: Option<&str>,
    )

Source from the content-addressed store, hash-verified

189 }
190
191 pub async fn update_session(
192 &self,
193 id: &str,
194 command: Option<&str>,
195 cwd: Option<&str>,
196 ) -> Result<PtySession, PtyError> {
197 let mut sessions = self.sessions.write().await;
198
199 if let Some((session, _)) = sessions.get_mut(id) {
200 if let Some(cmd) = command {
201 session.command = cmd.to_string();
202 }
203 if let Some(dir) = cwd {
204 session.cwd = dir.to_string();
205 }
206 Ok(session.clone())
207 } else {
208 Err(PtyError::SessionNotFound(id.to_string()))
209 }
210 }
211
212 pub async fn delete_session(&self, id: &str) -> bool {
213 let mut sessions = self.sessions.write().await;

Callers 1

update_ptyFunction · 0.80

Calls 2

get_mutMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected