pub struct Runner { /* private fields */ }Expand description
Port of clustertool.Runner. The zero value is not usable; use
Runner::new.
Implementations§
Source§impl Runner
impl Runner
Sourcepub fn new() -> Self
pub fn new() -> Self
Port of clustertool.NewRunner: wired to the process’s own standard
streams and terminal.
Sourcepub fn new_captured(
stdin_content: &[u8],
has_terminal: impl Fn() -> bool + Send + Sync + 'static,
) -> Self
pub fn new_captured( stdin_content: &[u8], has_terminal: impl Fn() -> bool + Send + Sync + 'static, ) -> Self
Test-only constructor: stdin_content is fed to the child’s stdin,
and its stdout/stderr are captured rather than inherited, readable
afterwards through Runner::stdout/Runner::stderr.
has_terminal stands in for has_controlling_terminal, so tests
do not depend on whether the suite happens to run from a terminal.
Sourcepub fn stdout(&self) -> Vec<u8> ⓘ
pub fn stdout(&self) -> Vec<u8> ⓘ
Returns everything written to stdout so far. Only meaningful for a
Runner::new_captured instance; always empty otherwise.
Sourcepub fn stderr(&self) -> Vec<u8> ⓘ
pub fn stderr(&self) -> Vec<u8> ⓘ
Returns everything written to stderr so far. Only meaningful for a
Runner::new_captured instance; always empty otherwise.
Sourcepub fn run(
&self,
mgr: &dyn Driver,
profile_name: &str,
tool: &Tool,
args: &[String],
) -> Result<i32, ClusterToolError>
pub fn run( &self, mgr: &dyn Driver, profile_name: &str, tool: &Tool, args: &[String], ) -> Result<i32, ClusterToolError>
Port of (*Runner).Run. Resolves the cluster kubeconfig from
mgr, writes it to a temporary file, and runs tool with args
attached to the caller’s streams. Returns the tool’s exit status,
which is only meaningful when the returned error is Ok; a tool
that could not be started at all yields Err.
See the module doc comment for why this takes mgr and
profile_name directly rather than loading them from an ambient
config context, as the Go original does.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Runner
impl !UnwindSafe for Runner
impl Freeze for Runner
impl Send for Runner
impl Sync for Runner
impl Unpin for Runner
impl UnsafeUnpin for Runner
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more