(
mut command: Command,
operation: &'static str,
input: Option<&[u8]>,
)
| 624 | } |
| 625 | |
| 626 | fn execute_raw( |
| 627 | mut command: Command, |
| 628 | operation: &'static str, |
| 629 | input: Option<&[u8]>, |
| 630 | ) -> Result<Output, WipCaptureError> { |
| 631 | if let Some(input) = input { |
| 632 | let mut child = command |
| 633 | .stdin(Stdio::piped()) |
| 634 | .stdout(Stdio::piped()) |
| 635 | .stderr(Stdio::piped()) |
| 636 | .spawn() |
| 637 | .map_err(|source| WipCaptureError::CommandIo { operation, source })?; |
| 638 | child |
| 639 | .stdin |
| 640 | .take() |
| 641 | .expect("piped Git stdin") |
| 642 | .write_all(input) |
| 643 | .map_err(|source| WipCaptureError::CommandIo { operation, source })?; |
| 644 | return child |
| 645 | .wait_with_output() |
| 646 | .map_err(|source| WipCaptureError::CommandIo { operation, source }); |
| 647 | } |
| 648 | |
| 649 | command |
| 650 | .output() |
| 651 | .map_err(|source| WipCaptureError::CommandIo { operation, source }) |
| 652 | } |
| 653 | |
| 654 | fn command_failure(operation: &'static str, output: &Output) -> WipCaptureError { |
| 655 | WipCaptureError::GitCommand { |
no test coverage detected