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)
| 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, |
no test coverage detected