|  | 
| 17 | 17 | 
 | 
| 18 | 18 | use std::process::Command; | 
| 19 | 19 | 
 | 
|  | 20 | +use tracing::info; | 
|  | 21 | + | 
| 20 | 22 | pub fn run_command(mut cmd: Command, desc: impl ToString) { | 
| 21 | 23 |     let desc = desc.to_string(); | 
| 22 |  | -    log::info!("Starting to {}, command: {:?}", &desc, cmd); | 
|  | 24 | +    info!("Starting to {}, command: {:?}", &desc, cmd); | 
| 23 | 25 |     let exit = cmd.status().unwrap(); | 
| 24 | 26 |     if exit.success() { | 
| 25 |  | -        log::info!("{} succeed!", desc) | 
|  | 27 | +        info!("{} succeed!", desc) | 
| 26 | 28 |     } else { | 
| 27 | 29 |         panic!("{} failed: {:?}", desc, exit); | 
| 28 | 30 |     } | 
| 29 | 31 | } | 
| 30 | 32 | 
 | 
| 31 | 33 | pub fn get_cmd_output_result(mut cmd: Command, desc: impl ToString) -> Result<String, String> { | 
| 32 | 34 |     let desc = desc.to_string(); | 
| 33 |  | -    log::info!("Starting to {}, command: {:?}", &desc, cmd); | 
|  | 35 | +    info!("Starting to {}, command: {:?}", &desc, cmd); | 
| 34 | 36 |     let result = cmd.output(); | 
| 35 | 37 |     match result { | 
| 36 | 38 |         Ok(output) => { | 
| 37 | 39 |             if output.status.success() { | 
| 38 |  | -                log::info!("{} succeed!", desc); | 
|  | 40 | +                info!("{} succeed!", desc); | 
| 39 | 41 |                 Ok(String::from_utf8(output.stdout).unwrap()) | 
| 40 | 42 |             } else { | 
| 41 | 43 |                 Err(format!("{} failed with rc: {:?}", desc, output.status)) | 
|  | 
0 commit comments