Skip to main content

ExecSession

Struct ExecSession 

Source
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

Source

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.

Source

pub fn pid(&self) -> u32

Returns the PID of the spawned process (as u32 for the protocol).

Source

pub async fn write_stdin(&self, data: &[u8]) -> AgentdResult<()>

Writes data to the process’s stdin (or PTY master).

Source

pub fn resize(&self, rows: u16, cols: u16) -> AgentdResult<()>

Resizes the PTY (only applicable for TTY sessions).

Source

pub fn send_signal(&self, signal: i32) -> AgentdResult<()>

Sends a signal to the spawned process.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.