pub struct ExecSession { /* private fields */ }Expand description
An active exec session handle for sending input to a running process.
Output reading is handled by a background task that sends events
via the mpsc channel provided at spawn time.
Implementations§
Source§impl ExecSession
impl ExecSession
Sourcepub fn spawn(
id: u32,
req: &ExecRequest,
tx: UnboundedSender<(u32, SessionOutput)>,
) -> AgentdResult<Self>
pub fn spawn( id: u32, req: &ExecRequest, tx: UnboundedSender<(u32, SessionOutput)>, ) -> AgentdResult<Self>
Spawns a new exec session.
If req.tty is true, uses a PTY. Otherwise, uses piped stdin/stdout/stderr.
A background task is spawned to read output and send events via tx.
Sourcepub async fn write_stdin(&self, data: &[u8]) -> AgentdResult<()>
pub async fn write_stdin(&self, data: &[u8]) -> AgentdResult<()>
Writes data to the process’s stdin (or PTY master).
Sourcepub fn resize(&self, rows: u16, cols: u16) -> AgentdResult<()>
pub fn resize(&self, rows: u16, cols: u16) -> AgentdResult<()>
Resizes the PTY (only applicable for TTY sessions).
Sourcepub fn send_signal(&self, signal: i32) -> AgentdResult<()>
pub fn send_signal(&self, signal: i32) -> AgentdResult<()>
Sends a signal to the spawned process.
Sourcepub fn close_stdin(&mut self)
pub fn close_stdin(&mut self)
Closes the process’s stdin.
For pipe mode, drops the ChildStdin handle which closes the fd.
For PTY mode, this is a no-op (the PTY master stays open for output).
Auto Trait Implementations§
impl Freeze for ExecSession
impl RefUnwindSafe for ExecSession
impl Send for ExecSession
impl Sync for ExecSession
impl Unpin for ExecSession
impl UnsafeUnpin for ExecSession
impl UnwindSafe for ExecSession
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
Mutably borrows from an owned value. Read more