fix: use which instead of where for command detection on Linux#54
Open
adamdaw wants to merge 1 commit intolangwatch:mainfrom
Open
fix: use which instead of where for command detection on Linux#54adamdaw wants to merge 1 commit intolangwatch:mainfrom
adamdaw wants to merge 1 commit intolangwatch:mainfrom
Conversation
The command_exists function used the Windows-only `where` command, causing all dependency checks (claude, git, gh) to fail silently on Linux. Fix: - Use `which` on non-Windows targets - Add explicit path checks for common Linux user bin locations (~/.local/bin, /usr/local/bin) and nvm-managed node bin dirs, since Tauri apps launch with a stripped PATH that excludes these Tested on Pop_OS 22.04.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix command detection on native Linux
Problem
The
command_existsfunction inlib.rsuses thewherecommand to check for installed dependencies (Claude Code, git, gh).whereis Windows-only — on Linux it doesn't exist, so all dependency checks fail silently and the onboarding wizard reports everything as "not found" regardless of what's actually installed.This affects anyone running the Tauri build on native Linux (e.g. Ubuntu, Pop_OS, Fedora). WSL users are unaffected since they're running a Windows host binary.
A second related issue: even after switching to
which, Tauri apps on Linux launch with a strippedPATHthat excludes common user bin directories. This means binaries installed via npm (~/.local/bin), nvm (~/.nvm/versions/node/*/bin), or manually to/usr/local/binwon't be found by a plainwhichcall.Fix
whichinstead ofwhereon non-Windows targetswhich:~/.local/bin(default npm global bin on many distros)/usr/local/bin/usr/bin~/.nvm/versions/node/*/bin(any installed nvm node version)Testing
Tested on Pop_OS 22.04 with:
~/.local/bin/claude)All three dependency checks (Claude Code, git, gh) now correctly resolve after this fix.