aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorYummyOreo <bobgim20@gmail.com>2024-06-19 05:55:03 -0500
committerGitHub <noreply@github.com>2024-06-19 11:55:03 +0100
commit5f66fb6a0365994ae2d0702e19c85c649acdd1a7 (patch)
treebd3574385e476190a1ca0e5aa6b67dd1e54ee83a /ui
parentFix `scroll_exits` default in `config.toml` (#2166) (diff)
downloadatuin-5f66fb6a0365994ae2d0702e19c85c649acdd1a7.zip
fix(gui): add support for checking if the cli is installed on windows (#2162)
* fix(windows): add support for checking if the cli is installed on windows * refactor: remove debugging info * refactor: cargo fmt
Diffstat (limited to 'ui')
-rw-r--r--ui/backend/src/install.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/ui/backend/src/install.rs b/ui/backend/src/install.rs
index 55877c4b..43ad0c54 100644
--- a/ui/backend/src/install.rs
+++ b/ui/backend/src/install.rs
@@ -23,9 +23,14 @@ pub(crate) async fn install_cli() -> Result<(), String> {
#[tauri::command]
pub(crate) async fn is_cli_installed() -> Result<bool, String> {
let shell = Shell::default_shell().map_err(|e| format!("Failed to get default shell: {e}"))?;
- let output = shell
- .run_interactive(&["atuin --version && echo 'ATUIN FOUND'"])
- .map_err(|e| format!("Failed to run interactive command"))?;
+ let output = if shell == Shell::Powershell {
+ shell.run_interactive(&["atuin --version; if ($?) {echo 'ATUIN FOUND'}"])
+ .map_err(|e| format!("Failed to run interactive command"))?
+ } else {
+ shell
+ .run_interactive(&["atuin --version && echo 'ATUIN FOUND'"])
+ .map_err(|e| format!("Failed to run interactive command"))?
+ };
Ok(output.contains("ATUIN FOUND"))
}