Skip to content

fix(terminal): restore full PATH and consistent shell init for PTY sessions#268

Open
dtger wants to merge 2 commits intocoollabsio:mainfrom
dtger:pty-path-binaries
Open

fix(terminal): restore full PATH and consistent shell init for PTY sessions#268
dtger wants to merge 2 commits intocoollabsio:mainfrom
dtger:pty-path-binaries

Conversation

@dtger
Copy link
Copy Markdown

@dtger dtger commented Mar 30, 2026

Summary

  • ensure PTY sessions on macOS inherit the user's full shell-derived PATH, including tools installed via Homebrew, bun, nvm, and similar setups
  • start interactive PTY shells as login shells and run shell-wrapped PTY commands with -lc for more consistent environment initialization
  • keep direct binary execution with command_args unchanged while reducing cases where commands work in an opened terminal but fail in a PTY-launched command

Problem

macOS GUI apps launched outside a terminal can inherit a minimal PATH, which caused PTY sessions to miss user-installed binaries. interactive PTY shells using login-shell behavior should also be aligned with shell-wrapped PTY commands.

Approach

  • call ensure_macos_path() before spawning PTY processes so terminal sessions inherit the corrected process environment
  • use -l for interactive Unix PTY shells
  • use -lc for Unix shell-wrapped PTY commands to align command execution with interactive terminal environment setup

Notes

  • this intentionally relies on the user's shell configuration to derive PATH on macOS, matching expected terminal behavior
  • direct binary invocation via command_args remains the preferred path when exact argument handling is needed

Danny T and others added 2 commits March 29, 2026 15:22
macOS GUI apps inherit a minimal PATH, so terminal sessions were missing
binaries from Homebrew, cargo, etc. Call ensure_macos_path() before PTY
spawn and use -l flag for interactive shells to source login profiles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant