Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic: Improved support for user-defined shells (e.g. fish / zsh, etc) #10105

Closed
axonasif opened this issue May 18, 2022 · 6 comments
Closed

Epic: Improved support for user-defined shells (e.g. fish / zsh, etc) #10105

axonasif opened this issue May 18, 2022 · 6 comments
Labels
feature: dotfiles feature: gitpod yml All things related to the gitpod.yml feature: tasks feature: terminal meta: stale This issue/PR is stale and will be closed soon team: IDE type: epic

Comments

@axonasif
Copy link
Member

axonasif commented May 18, 2022

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:


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:
Screenshot 2022-05-18 at 9 19 58 PM

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:

  1. Set SHELL env var in https://gitpod.io/variables or set in dockerfile to make the defined SHELL 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 like fish.
  2. Append some custom logic(hijacking PROMPT_COMMAND) into $HOME/.bashrc to run exec <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.

Footnotes

  1. https://github.com/axonasif/dotfiles/blob/5d50fdc8a6fd171ecf3ddeed6443ca45e1f817f3/src/main.sh#L61

@axonasif axonasif added feature: tasks feature: gitpod yml All things related to the gitpod.yml labels May 18, 2022
@loujaybee
Copy link
Member

loujaybee commented May 18, 2022

Agree, as I have this issue/challenge with using fish terminal, however terminal.integrated.defaultProfile.linux is VS Code specific, so would be good to have the configuration done somewhere that's IDE agnostic 🙏

@akosyakov
Copy link
Member

Yes, I think SHELL emv var is a still way to go. Honestly even if supervisor reads from terminal.integrated.defaultProfile.linux I doubt it will resolve issues with fish.

So the focus should be to resolve:

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 like fish.

@axonasif
Copy link
Member Author

Yes, I think SHELL emv var is a still way to go. Honestly even if supervisor reads from terminal.integrated.defaultProfile.linux I doubt it will resolve issues with fish.

Yep, I think we should cover both cases(imagine someone set from their dockerfile), can we add ; exec /your/shell/here at the end of a task script that we send to the terminal(detailed in the main issue)? That would potentially solve this.

@axonasif
Copy link
Member Author

Just noticed after daily driving SHELL=/usr/bin/zsh for a while, if you set your shell to something else other than bash with SHELL variable, you miss out on all the workspace customization we do (e.g environment variables, bashrc.d hooks).

Perhaps we should switch to other shells from bash env.

@loujaybee loujaybee changed the title .gitpod.yml:tasks switch to user-defined SHELL after completion of running the the task commands Epic: Improved support for user-defined SHELLs Sep 15, 2022
@loujaybee
Copy link
Member

loujaybee commented Sep 15, 2022

Hey folks, I have broadened the scope of this issue (the original description is in the toggle) to be an epic to contain other sub issues about improved support for user defined shells. I will start to update the description with other related issues. If you have issues with any shell when using Gitpod, please raise an issue with the specific issue you are facing, and we can then link it here to track general progress towards improved user-defined shell support 🙏

@stale
Copy link

stale bot commented Mar 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Mar 12, 2023
@stale stale bot closed this as completed Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: dotfiles feature: gitpod yml All things related to the gitpod.yml feature: tasks feature: terminal meta: stale This issue/PR is stale and will be closed soon team: IDE type: epic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants