pub struct ShellProc {
pub conn_name: String,
cmd: Box<dyn ConnInterface>,
close_once: AtomicBool,
done_tx: Option<Sender<i32>>,
done_rx: Option<Receiver<i32>>,
exit_code: Mutex<Option<i32>>,
}Expand description
A running shell process wrapping a ConnInterface.
Port of Go’s shellexec.ShellProc.
Fields§
§conn_name: StringConnection name (“local”, “wsl://distro”, “user@host”).
cmd: Box<dyn ConnInterface>The underlying PTY/process connection.
close_once: AtomicBoolEnsures close is called only once.
done_tx: Option<Sender<i32>>Signaled when the process exits. The i32 is the exit code.
done_rx: Option<Receiver<i32>>Receiver for wait completion.
exit_code: Mutex<Option<i32>>Exit code after wait completes.
Implementations§
Source§impl ShellProc
impl ShellProc
Sourcepub fn new(conn_name: String, cmd: Box<dyn ConnInterface>) -> Self
pub fn new(conn_name: String, cmd: Box<dyn ConnInterface>) -> Self
Create a new ShellProc wrapping a ConnInterface.
Sourcepub fn wait_and_signal(&mut self) -> i32
pub fn wait_and_signal(&mut self) -> i32
Wait for process exit and signal done channel. This should be called from a dedicated task.
Sourcepub fn take_done_rx(&mut self) -> Option<Receiver<i32>>
pub fn take_done_rx(&mut self) -> Option<Receiver<i32>>
Take the done receiver (can only be called once). Used by the block controller to await process completion.
Sourcepub fn get_exit_code(&self) -> Option<i32>
pub fn get_exit_code(&self) -> Option<i32>
Get the exit code (only valid after wait completes).
Auto Trait Implementations§
impl !Freeze for ShellProc
impl !RefUnwindSafe for ShellProc
impl Send for ShellProc
impl Sync for ShellProc
impl Unpin for ShellProc
impl !UnwindSafe for ShellProc
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.