Helpers intended for [`std::process::Command`].
| 11 | |
| 12 | /// Helpers intended for [`std::process::Command`]. |
| 13 | pub trait CommandRunExt { |
| 14 | /// Log (at debug level) the full child commandline. |
| 15 | fn log_debug(&mut self) -> &mut Self; |
| 16 | |
| 17 | /// Execute the child process and wait for it to exit. |
| 18 | /// |
| 19 | /// # Streams |
| 20 | /// |
| 21 | /// - stdin, stdout, stderr: All inherited |
| 22 | /// |
| 23 | /// # Errors |
| 24 | /// |
| 25 | /// An non-successful exit status will result in an error. |
| 26 | fn run_inherited(&mut self) -> Result<()>; |
| 27 | |
| 28 | /// Execute the child process and wait for it to exit. |
| 29 | /// |
| 30 | /// # Streams |
| 31 | /// |
| 32 | /// - stdin, stdout: Inherited |
| 33 | /// - stderr: captured and included in error |
| 34 | /// |
| 35 | /// # Errors |
| 36 | /// |
| 37 | /// An non-successful exit status will result in an error. |
| 38 | fn run_capture_stderr(&mut self) -> Result<()>; |
| 39 | |
| 40 | /// Execute the child process and wait for it to exit; the |
| 41 | /// complete argument list will be included in the error. |
| 42 | /// |
| 43 | /// # Streams |
| 44 | /// |
| 45 | /// - stdin, stdout, stderr: All nherited |
| 46 | /// |
| 47 | /// # Errors |
| 48 | /// |
| 49 | /// An non-successful exit status will result in an error. |
| 50 | fn run_inherited_with_cmd_context(&mut self) -> Result<()>; |
| 51 | |
| 52 | /// Ensure the child does not outlive the parent. |
| 53 | fn lifecycle_bind(&mut self) -> &mut Self; |
| 54 | |
| 55 | /// Execute the child process and capture its output. This uses `run_capture_stderr` internally |
| 56 | /// and will return an error if the child process exits abnormally. |
| 57 | fn run_get_output(&mut self) -> Result<Box<dyn std::io::BufRead>>; |
| 58 | |
| 59 | /// Execute the child process and capture its output as a string. |
| 60 | /// This uses `run_capture_stderr` internally. |
| 61 | fn run_get_string(&mut self) -> Result<String>; |
| 62 | |
| 63 | /// Execute the child process, parsing its stdout as JSON. This uses `run_capture_stderr` internally |
| 64 | /// and will return an error if the child process exits abnormally. |
| 65 | fn run_and_parse_json<T: serde::de::DeserializeOwned>(&mut self) -> Result<T>; |
| 66 | |
| 67 | /// Print the command as it would be typed into a terminal |
| 68 | fn to_string_pretty(&self) -> String; |
| 69 | } |
| 70 |
nothing calls this directly
no outgoing calls
no test coverage detected