Arch recommends users to keep a bash-compatible shell as default [0]. I'm using the method of exec
ing fish
from my .bashrc
.
pipenv fails on pipenv shell
, apparently because it thinks that the bash activate
should be executed
Spawning environment shell (/bin/bash). Use 'exit' to leave.
~/s/tmp î‚° source /home/me/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate
~/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate (line 23): Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
^
from sourcing file ~/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate
called on standard input
source: Error while reading file “/home/me/.local/share/virtualenvs/tmp-yq4UYSVl/bin/activate”
If I replace activate
with activate.fish
, the pipenv works as expected.
Could there be a flag or, even better yet, a config option to force the default environment shell?
[0] https://wiki.archlinux.org/index.php/Fish#Not_setting_fish_as_default_shell
$ python -V
$ pipenv --version
Huh, maybe an environment variable? @kennethreitz @nateprewitt or @techalchemy any thoughts?
@kehugter in compat mode your shell is determined by the SHELL
environment variable, so you can just export $SHELL in your .bashrc
or run the subshell with SHELL=/usr/bin/fish pipenv shell
and it should work. Let me know if this helps
@techalchemy I completely forgot about that, been working on windows too long.....
@techalchemy
export $SHELL in your
.bashrc
thanks, that works.
If I understand it correctly, this approach is fine on a local machine but would break the $SHELL
env var that Arch expects in remote non-login non-interactive shells:
https://blog.flowblok.id.au/static/images/shell-startup-actual.png
An edge case perhaps worth considering and documenting.
Yes, as with all shell configurations you should include interactive settings in interactive shells only. That information _is_ mentioned in the docs in the context of fish, but as a user who is concerned about edge cases of people trying to run an interactive pipenv shell on a non interactive shell, well that use case isn’t possible so you shouldn’t change the variable. If you want to be safe however you can follow the bash instructions about testing for interactivity before setting the value: see here
Most helpful comment
@kehugter in compat mode your shell is determined by the
SHELL
environment variable, so you can just export $SHELL in your.bashrc
or run the subshell withSHELL=/usr/bin/fish pipenv shell
and it should work. Let me know if this helps