pub struct TerminalHandle { /* private fields */ }Expand description
Handle to an active terminal session
This provides a convenient wrapper around a TerminalId that tracks
the terminal client and can be used to interact with the terminal.
When dropped, the handle will attempt to release the terminal if it hasn’t been explicitly released or if the command hasn’t completed.
Implementations§
Source§impl TerminalHandle
impl TerminalHandle
Sourcepub fn new(terminal_id: TerminalId, client: Arc<TerminalClient>) -> Self
pub fn new(terminal_id: TerminalId, client: Arc<TerminalClient>) -> Self
Create a new terminal handle
Sourcepub fn id(&self) -> &TerminalId
pub fn id(&self) -> &TerminalId
Get the terminal ID
Sourcepub async fn output(&self) -> Result<TerminalOutputResponse, AgentError>
pub async fn output(&self) -> Result<TerminalOutputResponse, AgentError>
Get the current output and status
Sourcepub async fn wait_for_exit(&self) -> Result<TerminalExitStatus, AgentError>
pub async fn wait_for_exit(&self) -> Result<TerminalExitStatus, AgentError>
Wait for the terminal command to exit
Returns the exit status once the command completes.
Sourcepub async fn kill(&self) -> Result<(), AgentError>
pub async fn kill(&self) -> Result<(), AgentError>
Kill the terminal command
Sends SIGTERM to terminate the command. The terminal remains valid and can still be queried for output.
Sourcepub async fn release(self) -> Result<(), AgentError>
pub async fn release(self) -> Result<(), AgentError>
Release the terminal and free resources
After calling this, the handle should not be used again.
Sourcepub async fn execute_and_wait(
&self,
) -> Result<(String, TerminalExitStatus), AgentError>
pub async fn execute_and_wait( &self, ) -> Result<(String, TerminalExitStatus), AgentError>
Execute a command and wait for completion, returning the output
This is a convenience method that polls for output and waits for exit. Returns the final output and exit status.
Sourcepub fn is_released(&self) -> bool
pub fn is_released(&self) -> bool
Check if the terminal has been released
Trait Implementations§
Source§impl Debug for TerminalHandle
impl Debug for TerminalHandle
Auto Trait Implementations§
impl Freeze for TerminalHandle
impl !RefUnwindSafe for TerminalHandle
impl Send for TerminalHandle
impl Sync for TerminalHandle
impl Unpin for TerminalHandle
impl !UnwindSafe for TerminalHandle
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
fn into_option(self) -> Option<T>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request