WIP: 26-integration-tests #35
@ -202,16 +202,21 @@ impl<T> CommandResult<T, StartError> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CommandResult<CommandOutput, ExecutionError<CommandOutput>> {
|
impl<T> CommandResult<T, ExecutionError<T>> {
|
||||||
pub fn into_result_with_error_logging(
|
pub fn into_result_with_error_logging(
|
||||||
self,
|
self,
|
||||||
logger: &Logger,
|
logger: &Logger,
|
||||||
) -> Result<CommandOutput, CommandError<ExecutionError<CommandOutput>>> {
|
) -> Result<T, CommandError<ExecutionError<T>>>
|
||||||
|
where
|
||||||
|
T: MaybeCast<CommandOutput>,
|
||||||
|
{
|
||||||
self.result.map_err(|error| {
|
self.result.map_err(|error| {
|
||||||
if let ExecutionError::BadExitStatus(output) = &error {
|
if let ExecutionError::BadExitStatus(t) = &error {
|
||||||
|
if let Some(output) = t.maybe_cast() {
|
||||||
log!(logger, error, "{}", output.stdout.to_string_lossy());
|
log!(logger, error, "{}", output.stdout.to_string_lossy());
|
||||||
log!(logger, error, "{}", output.stderr.to_string_lossy());
|
log!(logger, error, "{}", output.stderr.to_string_lossy());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
CommandError {
|
CommandError {
|
||||||
command: self.command,
|
command: self.command,
|
||||||
error,
|
error,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user