Issues with running tests in Terminus and PATH
rchl opened this issue · comments
On Mac, when I click the "Run test" inlay hint, it just opens a blank Terminus panel and crashes with:
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1488, in run_
return self.run(edit, **args)
File "/Users/rafal/Library/Application Support/Sublime Text/Installed Packages/Terminus.sublime-package/terminus/commands.py", line 536, in run
File "/Users/rafal/Library/Application Support/Sublime Text/Packages/Terminus/terminus/terminal.py", line 234, in start
self.process = TerminalPtyProcess.spawn(cmd, cwd=cwd, env=_env, dimensions=size)
File "/Users/rafal/Library/Application Support/Sublime Text/Packages/ptyprocess/all/ptyprocess/ptyprocess.py", line 210, in spawn
'executable: %s.' % command)
FileNotFoundError: The command was not found or was not executable: cargo.
On my system cargo
is in /Users/rafal/.cargo/bin/cargo
and the issue is that on Mac new processes start with pretty basic PATH that doesn't include stuff that .zprofile
or .zshrc
might add. So cargo
is not found.
We could potentially improve it by reading PATH
from the ST process (ST evaluates it on start using /bin/zsh -l
) and pass to the command that starts the Terminus or eventually run the Terminus command in context of the default shell.
Looked a bit more and I guess it's an user error mostly.
Terminus does inherit ST environment by default by doing os.environ.copy()
. The issue for me was that the $HOME/.cargo/bin
path was extended in .zshrc
rather than .zprofile
so it worked for terminal but not Terminus.
That said, there should ideally still be a better feedback for this case since all we get is a blank terminus panel in such cases.