diff --git a/build.gradle.kts b/build.gradle.kts
index 487749a1..3db9a490 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -49,6 +49,9 @@ intellijPlatform {
Update minimum version to 2026.1
+
+ Add fallback for finding rg with wsl2
+
""".trimIndent()
diff --git a/changelog.md b/changelog.md
index 19b60925..8b8e1c15 100644
--- a/changelog.md
+++ b/changelog.md
@@ -5,6 +5,7 @@
- Update dependencies
- Fix ETD errors
- Update minimum version to 2026.1
+- Add fallback for finding rg with wsl2
## Version 2.2.1
diff --git a/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendResolver.kt b/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendResolver.kt
index c7a5a17d..bef5938e 100644
--- a/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendResolver.kt
+++ b/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendResolver.kt
@@ -24,6 +24,7 @@
package com.mituuz.fuzzier.grep.backend
+import com.intellij.execution.process.ProcessNotCreatedException
import com.intellij.openapi.components.service
import com.mituuz.fuzzier.runner.CommandRunner
import com.mituuz.fuzzier.settings.FuzzierGlobalSettingsService
@@ -47,14 +48,17 @@ class BackendResolver(val isWindows: Boolean) {
executable: String,
projectBasePath: String
): Boolean {
- val command = if (isWindows) {
- listOf("where", executable)
+ val result = if (isWindows) {
+ try {
+ commandRunner.runCommandForOutput(listOf("where", executable), projectBasePath)
+ } catch (_: ProcessNotCreatedException) {
+ // Fallback for WSL2
+ commandRunner.runCommandForOutput(listOf("which", executable), projectBasePath)
+ }
} else {
- listOf("which", executable)
+ commandRunner.runCommandForOutput(listOf("which", executable), projectBasePath)
}
- val result = commandRunner.runCommandForOutput(command, projectBasePath)
-
return !(result.isNullOrBlank() || result.contains("Could not find files"))
}
}
\ No newline at end of file