Closed
Description
Improve the support for user-defined shells such as zsh, fish, etc.
Includes, but not limited to:
- Improve documentation around
SHELL
environment variable - Update Gitpod compatibility matrix
- Update default workspaces images
- Update any other parts of the product that assume bash (where possible)
Relates to:
- Epic: Persisted Terminal History #9019
- tasks: Fail on error by default (run with
bash -e
) #13558 - Python pip doesn't work properly in zsh workspace-images#984
- VSCODE terminals are automatically created without any visible reason #9531
Original issue description
Is your feature request related to a problem? Please describe
It would be nice to have Gitpod switch to the user defined(terminal.integrated.defaultProfile.linux
) SHELL after processing the task commands in bash
.
Describe the behaviour you'd like
- Imagine I have this on my
.gitpod.yml
:
tasks:
- name: combined tasks
command: echo "this is a command (combined)"
before: echo "this is a before (combined)"
- Upon workspace IDE start, I would see this on my task terminal:

Proposed solution
So, I think we could just put ; exec <user-shell>
(only if the user is not using bash as default) at the end of the script that we're sending to the task terminal, which could look like:
HISTFILE=/workspace/.gitpod/cmd-0 history -r; {
echo "this is a before (combined)"
} && {
echo "this is a command (combined)"
}; exec /usr/bin/fish # This here mainly
We might also need to consider having an option for .gitpod.yml
to disable the switching behavior as someone might not want it to switch on some specific use case.
Describe alternatives you've considered
There are two ways I know of at this moment:
- Set
SHELL
env var in https://gitpod.io/variables or set in dockerfile to make the definedSHELL
globally be used across the workspace, @akosyakov shared this trick 👍
However, this will cause issues since many of the bash builtins are either not present in other shells or behaves differently. On the other hand, we also have non POSIX shells likefish
. - Append some custom logic(hijacking
PROMPT_COMMAND
) into$HOME/.bashrc
to runexec <shell>
upon detection of a task terminal and to switch only after the commands have been run. This is done via utilizing the dotfiles feature of Gitpod 1
However, this is not a neat or straightforward method of doing this.
Additional context
Internal discussion on Slack.