Skip to content

fix(installer): improve shell detection and fix Fish shell PATH injection#378

Closed
hobostay wants to merge 1 commit intoRightNow-AI:mainfrom
hobostay:fix/fish-shell-detection
Closed

fix(installer): improve shell detection and fix Fish shell PATH injection#378
hobostay wants to merge 1 commit intoRightNow-AI:mainfrom
hobostay:fix/fish-shell-detection

Conversation

@hobostay
Copy link

@hobostay hobostay commented Mar 6, 2026

Fixes #372

Problem

The installer script only used the /bin/zsh environment variable to detect the user's shell. However, /bin/zsh reflects the login shell (e.g., /bin/bash or /bin/zsh), not the shell actually being used. When users ran the installer script from Fish shell, it would incorrectly inject Bash export syntax into their config.fish, breaking the shell.

Solution

  • Added detect_shell() function with multi-layer detection:

    1. Check shell-specific environment variables (FISH_VERSION, ZSH_VERSION, BASH)
    2. Fallback to /bin/zsh environment variable
    3. Detect from parent process name via ps command
    4. Default to bash for compatibility
  • Improved Fish shell handling:

    • Use fish_add_path command (recommended for Fish 3.3+)
    • Provide fallback set -gx PATH for older Fish versions
    • Avoid injecting Bash syntax into Fish config files

…tion

- Add robust shell detection using shell-specific env vars (FISH_VERSION, ZSH_VERSION, BASH)
- Add fallback to parent process detection via ps
- Use fish_add_path command for Fish 3.3+ with fallback for older versions
- Fix issue RightNow-AI#372 where Bash syntax was incorrectly injected into Fish config

This fixes the problem where users with Fish shell as their default shell
would get Bash export syntax in their config.fish, breaking the shell.
@jaberjaber23
Copy link
Member

Shell detection was reimplemented in v0.3.25. The original had a bug where the BASH env var short-circuited detection, breaking Zsh users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installer breaks Fish shell completely by injecting Bash syntax into config.fish

3 participants