pub struct SubprocListen { /* private fields */ }
Expand description
An event source that runs a subprocess and generates events for lines of output.
This event source will run a command as a subprocess, generate
ListenEvent::Line
events for every line it prints to stdout, and one
final ListenEvent::End
event when it ends.
Processes that run indefinitely can be killed (using SIGKILL
ie. 9 on
Linux) by returning true
from the callback provided to process_events()
or by calling the kill()
method. Note that there may be more
Line
events generated after this, depending on the order in which the kill
request and remaining output are processed.
After the subprocess has been ended and the final End
event has been
delivered, this event source should be removed from the event loop.
Implementations§
Trait Implementations§
Source§impl EventSource for SubprocListen
impl EventSource for SubprocListen
Source§type Event = ListenEvent
type Event = ListenEvent
The type of events generated by your source.
Source§type Error = LaunchError
type Error = LaunchError
The error type returned from
process_events()
(not the user callback!).Source§fn process_events<F>(
&mut self,
readiness: Readiness,
token: Token,
callback: F,
) -> Result<PostAction, Self::Error>
fn process_events<F>( &mut self, readiness: Readiness, token: Token, callback: F, ) -> Result<PostAction, Self::Error>
Process any relevant events Read more
Source§fn register(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory,
) -> Result<()>
fn register( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory, ) -> Result<()>
Register yourself to this poll instance Read more
Source§fn reregister(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory,
) -> Result<()>
fn reregister( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory, ) -> Result<()>
Re-register your file descriptors Read more
Source§fn unregister(&mut self, poll: &mut Poll) -> Result<()>
fn unregister(&mut self, poll: &mut Poll) -> Result<()>
Unregister your file descriptors Read more
Auto Trait Implementations§
impl !Freeze for SubprocListen
impl !RefUnwindSafe for SubprocListen
impl !Send for SubprocListen
impl !Sync for SubprocListen
impl Unpin for SubprocListen
impl !UnwindSafe for SubprocListen
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