//! Installing and removing the virtual monitor's driver through the app's elevated half //! (admin.spec.md, "Virtual monitor"). Windows only, with the driver files in `display-driver/` next //! to this program and `JARVIS_TEST_VDISPLAY=install` or `uninstall`, or `install-declined` (the //! person answers no to Windows' question: the install fails and leaves nothing installed); Windows //! asks for the administrator (and on install whether to trust the SignPath Foundation). Elsewhere //! it skips. //! No test harness: started elevated, this same program is the elevated half. fn main() { let args: Vec = std::env::args().collect(); if let Some(code) = jarvis_app::vdisplay::elevated_main(&args) { std::process::exit(code); } let Ok(action) = std::env::var("JARVIS_TEST_VDISPLAY") else { eprintln!("skipped: set JARVIS_TEST_VDISPLAY=install|install-declined|uninstall"); return; }; let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap(); let declined = action == "install-declined"; let outcome = rt.block_on(jarvis_app::vdisplay::run_elevated(if declined { "install" } else { &action })); let status = jarvis_app::vdisplay::status(); println!("{action}: {outcome:?} -> {status:?}"); if declined { assert!(outcome.is_err(), "a declined install fails"); } else { outcome.expect("the elevated half succeeds"); } assert_eq!(status.installed, action == "install"); assert!(!status.other, "nothing this app made looks like another program's driver"); assert!(!status.leftover, "nothing of this app's is left to clean up"); }