Skip to content

fix: detect invoking shell for init - #142

Open
lilien1010 wants to merge 2 commits into
tobi:mainfrom
lilien1010:lien/fix-fish-init-shell-detection
Open

fix: detect invoking shell for init#142
lilien1010 wants to merge 2 commits into
tobi:mainfrom
lilien1010:lien/fix-fish-init-shell-detection

Conversation

@lilien1010

Copy link
Copy Markdown
Contributor

Summary

  • detect the shell invoking try init from its parent process before consulting $SHELL
  • fall back to $SHELL when parent-process detection is unavailable
  • cover conflicting current/login shell values and real fish evaluation in the spec suite

Context

$SHELL is the login shell, so it can differ from the shell sourcing try init. Parent-process detection was added in 4cf1364 after #72, but only as a fallback when $SHELL is empty, leaving the reported case broken.

Fixes #141.

Verification

  • reproduced the failure with fish as the current shell and SHELL=/bin/zsh
  • rake test: 131 unit tests and 401/401 specs passed
  • verified try init | source defines the function in a real fish process with SHELL=/bin/zsh

Spinel was not available locally, so the native checks were skipped by the existing Rake task.

lilien1010 and others added 2 commits September 4, 2026 12:43
Assisted-By: devx/81468caa-b221-4aa1-a09a-044e49944132
A non-shell parent (script runner, make, non-exec wrapper) would
otherwise override a correct $SHELL=fish and emit bash syntax.
Fall back to $SHELL unless the parent name looks like a shell.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Assisted-By: devx/29cc08f5-8976-4c01-bdc7-ff3402fcbfbb
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.

try init returns bash syntax under fish when $SHELL is not fish

1 participant