Prefer Native Shell on supported Linux installations

This commit is contained in:
Kevin Yue committed 2026-11-20 22:00:51 +08:00
1 parent 4ba50ca945
commit d81b1dc3ec
37 files changed
+869 -250

No files matched your search

+19
View File
@@ -486,6 +486,25 @@ mod tests {
assert!(cli.can_run_alongside_client());
}
#[test]
#[cfg(target_os = "linux")]
fn launch_gui_interface_accepts_minimized_launch_but_not_an_auth_callback() {
for variant in ["tauri", "nsh"] {
assert!(Cli::try_parse_from(["gpclient", "launch-gui", "--interface", variant, "--minimized"]).is_ok());
assert!(
Cli::try_parse_from([
"gpclient",
"launch-gui",
"--interface",
variant,
"globalprotectcallback:token"
])
.is_err()
);
}
assert!(Cli::try_parse_from(["gpclient", "launch-gui", "--interface", "unknown"]).is_err());
}
#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
fn launch_gui_rejects_callback_with_minimized() {
+13 -6
View File
@@ -24,6 +24,14 @@ pub(crate) struct LaunchGuiArgs {
help = "The external-browser authentication callback URL"
)]
callback: Option<String>,
#[cfg(target_os = "linux")]
#[arg(
long,
value_enum,
conflicts_with = "callback",
help = "Launch this interface and remember it for future launches"
)]
interface: Option<gpapi::gui::GuiVariant>,
#[arg(long, help = "Launch the GUI minimized")]
minimized: bool,
}
@@ -61,7 +69,10 @@ impl<'a> LaunchGuiHandler<'a> {
return forward_auth_callback(callback);
}
if DesktopLauncher::activate_existing().await.is_ok() {
let launcher = DesktopLauncher::new(env!("CARGO_PKG_VERSION")).minimized(self.args.minimized);
#[cfg(target_os = "linux")]
let launcher = launcher.interface(self.args.interface);
if launcher.activate_or_reject_existing().await? {
info!("The GUI is already running");
return Ok(());
}
@@ -71,11 +82,7 @@ impl<'a> LaunchGuiHandler<'a> {
info!("Log file: {}", log_file_path);
let exit_status = DesktopLauncher::new(env!("CARGO_PKG_VERSION"))
.minimized(self.args.minimized)
.log_file(&log_file_path)
.launch()
.await?;
let exit_status = launcher.log_file(&log_file_path).launch().await?;
info!("Service exited with status: {}", exit_status);