| 63 | } |
| 64 | |
| 65 | fn run_command( |
| 66 | build_command: CommandBuilder, |
| 67 | ) -> impl Future<Item = String, Error = SubhandlerError<BisectError>> { |
| 68 | use error::protocol::Error::Process; |
| 69 | use error::protocol::ProcessError::{Encoding, Failed}; |
| 70 | |
| 71 | build_command() |
| 72 | .output_async() |
| 73 | .map_err(|_| SubhandlerError::Shared(Process(Failed))) |
| 74 | .and_then(|output| { |
| 75 | let output = if output.stdout.is_empty() { |
| 76 | output.stderr |
| 77 | } else { |
| 78 | output.stdout |
| 79 | }; |
| 80 | str::from_utf8(&output) |
| 81 | .map(String::from) |
| 82 | .map_err(|_| SubhandlerError::Shared(Process(Encoding))) |
| 83 | }) |
| 84 | } |
| 85 | |
| 86 | type FinishBisectError = (SubhandlerError<BisectError>, state::Connection); |
| 87 | |