pub struct PtySession { /* private fields */ }Expand description
A live PTY-managed child plus its output drainer. The owner (a worker process under Outcome B) holds this for the child’s lifetime.
Implementations§
Source§impl PtySession
impl PtySession
Sourcepub fn spawn(
cmd: CommandBuilder,
rows: u16,
cols: u16,
ring_bytes: usize,
) -> Result<PtySession, PtyError>
pub fn spawn( cmd: CommandBuilder, rows: u16, cols: u16, ring_bytes: usize, ) -> Result<PtySession, PtyError>
Spawn cmd on a fresh PTY of rowsxcols with an output ring of
ring_bytes, and start the drainer thread.
Sourcepub fn drain_outcome(&self) -> DrainOutcome
pub fn drain_outcome(&self) -> DrainOutcome
Why the drainer stopped (or DrainOutcome::Running if still draining).
The daemon turns an Errored outcome into a pty_drainer_errored event.
Sourcepub fn write_input(&self, bytes: &[u8]) -> Result<(), PtyError>
pub fn write_input(&self, bytes: &[u8]) -> Result<(), PtyError>
Write bytes to the child’s stdin (PTY master). The caller is responsible for any envelope wrapping (non-Claude providers).
Sourcepub fn resize(&self, rows: u16, cols: u16) -> Result<(), PtyError>
pub fn resize(&self, rows: u16, cols: u16) -> Result<(), PtyError>
Resize the PTY (drive resize handshake, terminal change).
Sourcepub fn dropped_bytes(&self) -> u64
pub fn dropped_bytes(&self) -> u64
Bytes dropped from the ring due to overflow.
Sourcepub fn read_since(&self, cursor: u64) -> ReadSince
pub fn read_since(&self, cursor: u64) -> ReadSince
Incrementally read PTY output appended after cursor (drive streaming).
See BoundedRing::read_since. A poisoned ring recovers in place rather
than propagating a panic onto the drive output pump.
Sourcepub fn is_child_alive(&self) -> bool
pub fn is_child_alive(&self) -> bool
True if the child has not yet exited.
On a poisoned child mutex this returns true (assume alive), NOT
false: the primary consumer is Drop, which kills the child only when
this reports alive. Reporting false on poison would skip the kill and
leak a still-running child. Erring toward “alive” makes Drop attempt
the (idempotent) kill instead.
Trait Implementations§
Source§impl Drop for PtySession
impl Drop for PtySession
Auto Trait Implementations§
impl !Freeze for PtySession
impl !RefUnwindSafe for PtySession
impl !Sync for PtySession
impl !UnwindSafe for PtySession
impl Send for PtySession
impl Unpin for PtySession
impl UnsafeUnpin for PtySession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.