Run a binary with args, bounded by [`PROBE_TIMEOUT`]. `kill_on_drop` reaps the child when the future is dropped on timeout so orphans do not accumulate.
(program: &str, args: &[&str])
| 796 | /// Run a binary with args, bounded by [`PROBE_TIMEOUT`]. `kill_on_drop` reaps |
| 797 | /// the child when the future is dropped on timeout so orphans do not accumulate. |
| 798 | async fn run_bounded_binary(program: &str, args: &[&str]) -> Option<String> { |
| 799 | let fut = tokio::process::Command::new(program) |
| 800 | .args(args) |
| 801 | .no_window() |
| 802 | .kill_on_drop(true) |
| 803 | .output(); |
| 804 | match tokio::time::timeout(PROBE_TIMEOUT, fut).await { |
| 805 | Ok(Ok(output)) if output.status.success() => { |
| 806 | Some(String::from_utf8_lossy(&output.stdout).to_string()) |
| 807 | } |
| 808 | _ => None, |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | /// Run `command` through the user's login shell and return its stdout on |
| 813 | /// success. GUI apps don't inherit the shell PATH, and version managers |
no test coverage detected