pub enum BackgroundTerminal {
Running {
child: ChildHandle,
output_buffer: Arc<Mutex<String>>,
last_read_offset: Arc<AtomicUsize>,
},
Finished {
status: TerminalExitStatus,
final_output: String,
},
}Expand description
Background terminal state
Variants§
Running
Terminal is still running
Fields
§
child: ChildHandleThe child process handle (wrapped or unwrapped)
§
last_read_offset: Arc<AtomicUsize>Last read offset for incremental output Using AtomicUsize for lock-free atomic operations
Finished
Terminal has finished
Implementations§
Source§impl BackgroundTerminal
impl BackgroundTerminal
Sourcepub fn new_running(child: ChildHandle) -> Self
pub fn new_running(child: ChildHandle) -> Self
Create a new running terminal with a child handle
Sourcepub fn new_running_unwrapped(child: Child) -> Self
pub fn new_running_unwrapped(child: Child) -> Self
Create a new running terminal from a legacy Child (unwrapped) Note: stdout/stderr should be taken before creating the handle
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if terminal is still running
Sourcepub fn status_str(&self) -> &'static str
pub fn status_str(&self) -> &'static str
Get the status string
Sourcepub async fn get_incremental_output(&self) -> String
pub async fn get_incremental_output(&self) -> String
Get incremental output since last read
Sourcepub async fn append_output(&self, output: &str)
pub async fn append_output(&self, output: &str)
Append output to the buffer (for running terminals)
Sourcepub async fn get_all_output(&self) -> String
pub async fn get_all_output(&self) -> String
Get all output
Sourcepub async fn finish(self, status: TerminalExitStatus) -> Self
pub async fn finish(self, status: TerminalExitStatus) -> Self
Transition to finished state
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BackgroundTerminal
impl !RefUnwindSafe for BackgroundTerminal
impl Send for BackgroundTerminal
impl Sync for BackgroundTerminal
impl Unpin for BackgroundTerminal
impl !UnwindSafe for BackgroundTerminal
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
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>
Wrap the input message
T in a tonic::Request