Skip to content

Conversation

@MikeMcQuaid
Copy link
Member

@MikeMcQuaid MikeMcQuaid commented Jan 12, 2026

Relying on SHELL is not reliable enough to detect e.g. fish given how some of our users do it.

Let's fall back to using ps and instead add a fallback for sandboxes.

@maschwenk @bolinfest The needs of Fish, the macOS sandbox and e.g. Cursor here contradict so we're going to move back to the original ps method that has worked well for years. If that's not working for you, hopefully the fallback here will work or you can just use e.g. brew shellenv zsh to bypass it all (and speed it up at little).

Fixes #21388
Fixes Homebrew/install#1069
Fixes #21382

See also #21157, #21284, #21374

Relying on `SHELL` is not reliable enough to detect e.g. `fish` given
how some of our users do it.

Let's fall back to using `ps` and instead add a fallback for sandboxes.
Copilot AI review requested due to automatic review settings January 12, 2026 09:19
@MikeMcQuaid MikeMcQuaid enabled auto-merge January 12, 2026 09:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves shell detection in the shellenv command by prioritizing the parent process name (obtained via ps) over the SHELL environment variable, while maintaining a fallback for sandboxed environments where ps may not work.

Changes:

  • Implements a three-tier shell detection strategy: explicit parameter → parent process name via psSHELL environment variable
  • Adds comments explaining each detection method and its limitations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Jan 12, 2026
Merged via the queue into main with commit d585614 Jan 12, 2026
43 checks passed
@MikeMcQuaid MikeMcQuaid deleted the more_shellenv_fixes branch January 12, 2026 14:02
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.

shellenv shell detection is broken for fish fish shell not detected /opt/homebrew/bin/brew shellenv uses invalid syntax on fish 4.2.1

3 participants