-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add shell: sh #432
base: main
Are you sure you want to change the base?
Add shell: sh #432
Conversation
Hi. Thank you for your suggestion!
What do you mean by does not work? Does it give an error message you could share? Does the shell work if you select Use system default? The I'll need to consider this a bit. It might make sense to make As it's already possible to define custom shells that allow you to specify the shell's path freely, I don't see this as an urgent thing, but I do see that it would be an easier option, especially for new users. For this to be merged, I'd like all the commit messages to be prefixed with an issue number. And as this doesn't have an issue yet, it would be good to go the normal feature request route and create a discussion for this, after which I can create an issue if I'll decide to merge this code. I haven't received many pull requests yet, so I haven't really polished up the PR process yet. I guess I'll need to write some instructions to recommend creating a discussion before a pull request 🙂. |
Hi I might have been a bit too quick when writing the initial PR comment but I'll answer your questions below. :)
The error I get is the following:
I've always used the Use System Default option so that unfortunately didn't change anything.
I think having the possibility for selecting the shell explicitly, especially the usual system defaults (as in shells that usually comes with systems) like sh, bash, zsh and dash is quite a safe choice for at least Linux and Mac (I haven't used Windows in many years so I can't testify for it). In the case of Bash and the
I did see that this was possible but didn't look further into it, I could take a look at how to define one. One really nice way of handling this would be to allow the shell to be run using This is for example used in Python Virtual Environments. #!/usr/bin/env python Then when you're using the virtual environment, PATH is prepended with that virtual environments python executable, this has the upside of not touching the System-level python packages.
I'll happily rebase and correct the commit messages when/if we get to a conclusion :) |
While I was writing the comment above I was also experimenting a bit more using the main branch just to familiarize myself with the flow of the plugin. The ChildProsess log is in I might just make this PR into a fix for that instead, thoughts? |
So I've played around a bit more, the issue I described in the above comment is still relevant, as in even though I can however as you mentioned use Custom Shells and point it to I'm also able to create a custom shell using If you do decide to accept the PR as is (to add |
Thank you for your replies! 🙂 I didn't read it all yet as I'm in a bit of hurry now, but I'll come back to this in the coming weeks, if not this week.
Yes, this is the case. The shell paths are hardcoded, and even the "Use system default" option does not really use the system's default shell path, instead it just tries to match the shell binary's name with the hardcoded paths, and then uses one of them. It's definitely confusing. Right now I can't remember how I came up with this (I could look into this), but it's definitely something that can be improved to really use the system default shell path. |
Hi again @husjon , and sorry for the delay! I'll answer the rest of your messages now. I have thought about this addition of About
|
Hi and no worries about the delay, I was able to get unblocked by creating a custom shell. :)
I did a quick search yesterday and found a few posts saying that it is available on MacOS too (one from 2017 https://apple.stackexchange.com/questions/297533/does-macos-have-usr-bin-env which also links the manpage for it), it is a different version (BSD vs GNU) but the end result is the same, which in this context is to look up the shell to run the commands as. I can't speak for all non-FHS systems, but in in my case with NixOS it tries to bridge the gap with at least providing some bare minimum known paths, like
As for performance, it would call it negligible. Single execution1000 runs
To reduce the need for duplication, it would be nice if for example the Bash shell (and the others) tried
I found this out the other day as I was trying to use the provided variables ( I think this would also work for Windows systems as in if you wrap the variable in normal double quotation marks it should keep the string as is, but I might be wrong. :) On Linux
I'll go through and rebase and update the commit messages with the issue number shortly after finishing this message. Happy to help and thanks to you too. :) |
The
sh
reference in Shell_Bash.ts#L28 unfortunately does not work, in particular on NixOS which does not use traditional FHS, as such the only way to spawn a shell without knowing the path is to use/usr/bin/env bash
or/usr/bin/env zsh
etc.Since this was not possible to add quickly, I instead decided to add a separate Shell for
/bin/sh
which is available (also on most if not all Linux distros and MacOS).In short, this PR moves the
sh
reference to a separate Shell (Shell_Sh.ts
) to allow it to be selected separately.