mirror of
https://github.com/winapps-org/winapps.git
synced 2025-06-04 06:07:19 +02:00
feat: use new error handling & logging for freerdp & the cli
This commit is contained in:
parent
90079a4982
commit
0e5276c744
@ -1,7 +1,7 @@
|
|||||||
use clap::{arg, Command};
|
use clap::{arg, Command};
|
||||||
use winapps::freerdp::freerdp_back::Freerdp;
|
use winapps::freerdp::freerdp_back::Freerdp;
|
||||||
use winapps::quickemu::{create_vm, kill_vm, start_vm};
|
use winapps::quickemu::{create_vm, kill_vm, start_vm};
|
||||||
use winapps::RemoteClient;
|
use winapps::{unwrap_or_panic, RemoteClient};
|
||||||
|
|
||||||
fn cli() -> Command {
|
fn cli() -> Command {
|
||||||
Command::new("winapps-cli")
|
Command::new("winapps-cli")
|
||||||
@ -69,18 +69,22 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Some((_, _)) => {
|
Some((_, _)) => {
|
||||||
cli.about("Command not found, try existing ones!")
|
unwrap_or_panic!(
|
||||||
.print_help()
|
cli.about("Command not found, try existing ones!")
|
||||||
.expect("Couldn't print help");
|
.print_help(),
|
||||||
|
"Couldn't print help"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Some((_, _)) => {
|
Some((_, _)) => {
|
||||||
cli.about("Command not found, try existing ones!")
|
unwrap_or_panic!(
|
||||||
.print_help()
|
cli.about("Command not found, try existing ones!")
|
||||||
.expect("Couldn't print help");
|
.print_help(),
|
||||||
|
"Couldn't print help"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
pub mod freerdp_back {
|
pub mod freerdp_back {
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
|
use tracing::{info, warn};
|
||||||
|
|
||||||
use crate::{Config, RemoteClient};
|
use crate::{unwrap_or_exit, Config, RemoteClient};
|
||||||
|
|
||||||
pub struct Freerdp {}
|
pub struct Freerdp {}
|
||||||
|
|
||||||
@ -11,18 +12,21 @@ pub mod freerdp_back {
|
|||||||
xfreerdp.stdout(Stdio::null());
|
xfreerdp.stdout(Stdio::null());
|
||||||
xfreerdp.stderr(Stdio::null());
|
xfreerdp.stderr(Stdio::null());
|
||||||
xfreerdp.args(["-h"]);
|
xfreerdp.args(["-h"]);
|
||||||
xfreerdp
|
|
||||||
.spawn()
|
|
||||||
.expect("Freerdp execution failed! It needs to be installed!");
|
|
||||||
println!("Freerdp found!");
|
|
||||||
|
|
||||||
println!("All dependencies found!");
|
unwrap_or_exit!(
|
||||||
println!("Running explorer as test!");
|
xfreerdp.spawn(),
|
||||||
println!("Check yourself if it appears correctly!");
|
"Freerdp execution failed! It needs to be installed!",
|
||||||
|
);
|
||||||
|
|
||||||
|
info!("Freerdp found!");
|
||||||
|
|
||||||
|
info!("All dependencies found!");
|
||||||
|
info!("Running explorer as test!");
|
||||||
|
warn!("Check yourself if it appears correctly!");
|
||||||
|
|
||||||
self.run_app(config, Some(&"explorer.exe".to_string()));
|
self.run_app(config, Some(&"explorer.exe".to_string()));
|
||||||
|
|
||||||
println!("Test finished!");
|
info!("Test finished!");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_app(&self, config: Config, app: Option<&String>) {
|
fn run_app(&self, config: Config, app: Option<&String>) {
|
||||||
@ -56,7 +60,11 @@ pub mod freerdp_back {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xfreerdp.spawn().expect("Freerdp execution failed!");
|
|
||||||
|
unwrap_or_exit!(
|
||||||
|
xfreerdp.spawn(),
|
||||||
|
"Freerdp execution failed, check logs above!",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user