horto_os_ui_tui/
probe_job.rs1use horto_os_ui_shared::{
4 probe_surfaces, remote_box_snapshot, RemoteBoxSnapshot, RemoteOptions, SurfaceProbeReport,
5 SystemProcessRunner,
6};
7
8pub struct RemoteProbeOk {
10 pub report: SurfaceProbeReport,
12 pub snapshot: Option<Result<RemoteBoxSnapshot, String>>,
14}
15
16pub struct RemoteProbeOutcome {
18 pub host: String,
20 pub result: Result<RemoteProbeOk, String>,
22}
23
24pub fn run_remote_probe(opts: &RemoteOptions, full: bool) -> RemoteProbeOutcome {
26 let host = opts.host.clone();
27 match probe_surfaces(&SystemProcessRunner, opts, false) {
28 Ok(report) => {
29 let snapshot = if report.cli.current {
30 Some(
31 remote_box_snapshot(&SystemProcessRunner, opts, full)
32 .map_err(|e| e.to_string()),
33 )
34 } else {
35 None
36 };
37 RemoteProbeOutcome {
38 host,
39 result: Ok(RemoteProbeOk { report, snapshot }),
40 }
41 }
42 Err(e) => RemoteProbeOutcome {
43 host,
44 result: Err(e.to_string()),
45 },
46 }
47}