MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / trigger_pty_flush

Method trigger_pty_flush

virtio-devices/src/console.rs:353–364  ·  view source on GitHub ↗

This function should be called when the other end of the PTY is connected. It verifies if this is the first time it's been invoked after the connection happened, and if that's the case it flushes all output from the console to the PTY. Otherwise, it's a no-op.

(&mut self)

Source from the content-addressed store, hash-verified

351 // after the connection happened, and if that's the case it flushes
352 // all output from the console to the PTY. Otherwise, it's a no-op.
353 fn trigger_pty_flush(&mut self) -> result::Result<(), anyhow::Error> {
354 if let (Some(pty_write_out), Some(out)) = (&self.write_out, &mut self.out) {
355 if pty_write_out.load(Ordering::Acquire) {
356 return Ok(());
357 }
358 pty_write_out.store(true, Ordering::Release);
359 out.flush()
360 .map_err(|e| anyhow!("Failed to flush PTY: {e:?}"))
361 } else {
362 Ok(())
363 }
364 }
365
366 fn register_file_event(
367 &mut self,

Callers 3

handle_eventMethod · 0.45
handle_timeoutMethod · 0.45
event_listMethod · 0.45

Calls 1

flushMethod · 0.45

Tested by

no test coverage detected