MCPcopy Create free account
hub / github.com/GCWing/BitFun / read

Method read

src/crates/services/services-integrations/src/remote_ssh/manager.rs:2479–2496  ·  view source on GitHub ↗

Read data from PTY. Blocks until data is available, PTY closes, or an error occurs. Returns Ok(Some(bytes)) for data, Ok(None) for clean close, Err for errors.

(&self)

Source from the content-addressed store, hash-verified

2477 /// Blocks until data is available, PTY closes, or an error occurs.
2478 /// Returns Ok(Some(bytes)) for data, Ok(None) for clean close, Err for errors.
2479 pub async fn read(&self) -> anyhow::Result<Option<Vec<u8>>> {
2480 let mut channel = self.channel.lock().await;
2481 loop {
2482 match channel.wait().await {
2483 Some(russh::ChannelMsg::Data { data }) => return Ok(Some(data.to_vec())),
2484 Some(russh::ChannelMsg::ExtendedData { data, .. }) => {
2485 return Ok(Some(data.to_vec()));
2486 }
2487 Some(russh::ChannelMsg::Eof) | Some(russh::ChannelMsg::Close) => return Ok(None),
2488 Some(russh::ChannelMsg::ExitStatus { .. }) => return Ok(None),
2489 Some(_) => {
2490 // WindowAdjust, Success, RequestSuccess, etc. — skip and keep reading
2491 continue;
2492 }
2493 None => return Ok(None),
2494 }
2495 }
2496 }
2497
2498 /// Close PTY session
2499 pub async fn close(self) -> anyhow::Result<()> {

Callers 15

runFunction · 0.45
add_file_entryFunction · 0.45
ensure_serviceFunction · 0.45
restore_saved_botsFunction · 0.45
remote_connect_startFunction · 0.45
remote_connect_stopFunction · 0.45
remote_connect_stop_botFunction · 0.45
remote_connect_statusFunction · 0.45

Calls 1

waitMethod · 0.45

Tested by 3

test_ai_connectionFunction · 0.36
http_getFunction · 0.36
http_post_jsonFunction · 0.36