Skip to content

Release build cannot find gh/glab — PATH not resolved from login shell #123

@dgershman

Description

@dgershman

Problem

When Crow is launched as a .app bundle from Finder/Dock, issues don't load. Running with PATH=$PATH ./Crow.app/Contents/MacOS/CrowApp works, confirming the issue is PATH resolution.

macOS gives .app bundles a minimal PATH (/usr/bin:/bin:/usr/sbin:/sbin). Tools installed via Homebrew (e.g. gh at /opt/homebrew/bin) are not found by /usr/bin/env. This does not affect make debug / swift run since those inherit the terminal's full environment.

Root Cause

All subprocess execution in the app uses /usr/bin/env to find tools, but never resolves the user's login shell PATH. ProcessInfo.processInfo.environment only has the minimal Finder PATH.

Affected files

  • Sources/Crow/App/IssueTracker.swiftshell() and shellWithStatus()
  • Packages/CrowProvider/Sources/CrowProvider/ProviderManager.swiftshell() (also has conditional env bug)
  • Packages/CrowGit/Sources/CrowGit/GitManager.swiftrun() (never sets environment at all)
  • Sources/Crow/App/AppDelegate.swift — dependency check uses /usr/bin/which with same minimal PATH

Proposed Fix

Add a ShellEnvironment singleton in CrowCore that:

  1. On first access, runs the user's login shell (zsh -lc 'echo $PATH') to get the real PATH
  2. Falls back to appending /opt/homebrew/bin, /usr/local/bin if shell resolution fails
  3. Provides ShellEnvironment.shared.env for all Process calls
  4. Provides ShellEnvironment.shared.hasCommand(_:) for tool detection

Then update all 4 files to use the enriched environment.

Reproduction

  1. make release
  2. Launch Crow.app from Finder (not terminal)
  3. Issues panel is empty
  4. Workaround: PATH=$PATH ./Crow.app/Contents/MacOS/CrowApp — issues load

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions