Resolving esp32dev dependencies...
Library Manager: Installing git+https://github.com/PaulStoffregen/XPT2046_Touchscreen.git
git version 2.50.1
Cloning into '/Users/dpatterson/.platformio/.cache/tmp/pkg-installing-cobcs9qw'...
fatal: not a git repository: '?]1337;SetBadgeFormat=LW4gbWFjcHJvLTIwMTkuZHBjCnRtcC9wa2ctaW5zdGFsbGluZy1jb2Jjczlxdy8uZ2l0Cgo=?/Users/dpatterson/.platformio/.cache/tmp/pkg-installing-cobcs9qw/.git'
fatal: /usr/local/opt/git/libexec/git-core/git-submodule cannot be used without a working tree.
VCSBaseException: VCS: Could not process command ['git', 'clone', '--recursive', '--depth', '1', 'https://github.com/PaulStoffregen/XPT2046_Touchscreen.git', '/Users/dpatterson/.platformio/.cache/tmp/pkg-installing-cobcs9qw']
Except that isn’t the actual command. That is what the command is built from.
Anyway, I have figured out where some of the strangeness of the error message is coming from. In
fatal: not a git repository: '?]1337;SetBadgeFormat=LW4gbWFjcHJvLTIwMTkuZHBjCnRtcC9wa2ctaW5zdGFsbGluZy1mcXl0NHppZi8uZ2l0Cgo=?
The “?]1337;SetBadgeFormat=…” is the output of a bash function that is part of my standard setup. The apparent garbage following it is actually base64-encoded text that decodes to “tmp/pkg-installing-fqyt4zif/.git”. That’s the temporary directory that the repository is being cloned to.
What I don’t know is how that is getting into the command stream. The function in question is called by my cd function when I change directories to update the iTerm “badge” with the current directory.
I tried issuing pio pkg install -l https://github.com/PaulStoffregen/XPT2046_Touchscreen.git and it fails with the same error.
How on earth is the output from a bash printf getting into the command input stream?
iTerm is a very capable terminal app for the Mac that I have been using for many years.
One of its nice capabilities is to display a “badge” in the upper-right corner of the window. This badge can contain whatever text you like and is updated by sending proprietary escape sequences to the terminal.
I use this functionality in my change-directory (cd) script to update the badge with the current host name, current directory, and current git branch (if the current directory is a git repository).
It appears that the pio pkg install command script performs a cd at some point and is capturing and attempting to process the escape sequence that my cd script sends to update the badge.
iTerm, itself, has nothing to do with this problem.
I did a little digging and in platformio-core/platformio/package/manager/base.py in the call_pkg_script() function is a line that starts with with fs.cd(pkg.path):. That class does call os.chdir() in its __enter__() and __exit__() methods.
As I said, I’m no python expert so I haven’t been able to get any farther yet.
CC @ivankravets weird bug on MacOS + iTerm during regular package installation, should be triggerable with pio pkg install -g -l https://github.com/PaulStoffregen/XPT2046_Touchscreen.git