Improve how external commands are run in non-interactive shells
In iterm2-discuss, Roberto writes:
I have some man pages installed in a custom location and available in the "Library Functions" section (3). Whilst I can access those man pages regularly with the man command, these pages are not visible when I use the "info" button on the touchbar.
Is the MANPATH variable defined in my .bash_profile not used by the touchbar? Is the INFO button only looking in section 1 of the man? What command is actually running behind the scenes when I click on the INFO button?
When you select the manpage button in the touch bar it runs:
sh -c "man || sleep 3"
When bash is run as "sh" it does not source any dotfiles.
I wonder if I should instead run /bin/bash --login -c "man || sleep 3". This has the benefit of respecting settings in .profile or .bash_profile, but could do unexpected things if loading your .profile produces output or runs slowly, and wouldn't help people who use other shells. I guess the next level would be to detect the user's shell and do the "right thing" for zsh, tcsh, and fish users.
Internally this goes throught openSingleUseWindowWithCommand:
.