Page 1 of 1

Problem in Files terminal with iTerm2 2.9 beta shell integration (Files v 1.0.9)

Posted: Wed Sep 02, 2015 1:53 am
by achekulaev
In Files terminal

Image

In regular terminal

Image

Re: Weird stuff in terminals with PS1 (v 1.0.9)

Posted: Fri Sep 04, 2015 8:38 am
by mike
Not sure what PS1 is. Can you explain it a bit?

Re: Weird stuff in terminals with PS1 (v 1.0.9)

Posted: Fri Sep 04, 2015 3:18 pm
by achekulaev
$PS1 is an environment variable in bash that defines how bash prompt looks like. It can be customized in .bashrc or .bash_profile
For details see: http://www.thegeekstuff.com/2008/09/bas ... ina-jolie/

I thought that my recent customizations to this variable caused this problem in Files. But I found out it's something else.

The issue is being caused by iTerm2 shell integration introduced in iTerm2.9 beta (https://www.iterm2.com/version3.html).
Here is the customization file itself (a shell script that gets included in .bash_profile and provides some cool stuff in iTerm2) https://gist.github.com/achekulaev/c1e15a1ed39e60905a6a

You can test it by saving file from Gist as ~/.iterm2_shell_integration.bash and then including in your .bash_profile like this:

Code: Select all

test -e ${HOME}/.iterm2_shell_integration.bash && source ${HOME}/.iterm2_shell_integration.bash
You'll notice it doesn't cause problems in regular Terminal.app.
If I comment out this integration in my .bash_profile then terminal in Files doesn't show that weird stuff.

I see warnings at the beginning of that script.
Maybe they will give you some clues why this integration is causing problems in Files but not anywhere else
I'm guessing you might be overriding either "DEBUG" trap or "PROMPT_COMMAND" variable

Code: Select all

# Note: this module requires 2 bash features which you must not otherwise be
# using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable.  iterm2_preexec_install
# will override these and if you override one or the other this _will_ break.

# This is known to support bash3, as well as *mostly* support bash2.05b.  It
# has been tested with the default shells on MacOS X 10.4 "Tiger", Ubuntu 5.10
# "Breezy Badger", Ubuntu 6.06 "Dapper Drake", and Ubuntu 6.10 "Edgy Eft".
p.s. I have changed topic name to reflect my investigations

Re: Problem in Files terminal with iTerm2 2.9 beta shell integration (Files v 1.0.9)

Posted: Fri Sep 11, 2015 7:59 am
by mike
achekulaev, sorry for a late reply.
Your investigations are absolutely right - Files uses "PROMPT_COMMAND" of Bash to know it's current directory and to receive signals when that path changes. Without such feedback an integration between Bash and Files would be much weaker.
This approach is somewhat based on MC's one - it uses the same mechanism.