-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(bash): use eval
instead of a procsub for the POSIX mode
#5020
Conversation
b3995ab
to
4d8dd39
Compare
4d8dd39
to
d52aa5b
Compare
@davidkna Could you take a look at this PR? I just wanted to submit another PR to solve issues with the Maybe the code coverage error in the CI blocks the reviewing but I'd like some advice about how to fix it (or whether I should fix it in the first place because I think the part I modified wasn't covered by the test even before this change. In the part to which |
I think this PR also solves the problem that PR #3660 tried to solve. The problem PR #3660 attempts to solve is that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you for your quick response! If there is anything additional needed, please let me know. |
Thank you for your contribution @akinomyoga and thanks for reviewing @davidkna. |
Thank you! |
Description
Use
eval -- "$(/path/to/starship init bash --print-full-init)"
, which works in any version of Bash and also in the POSIX mode, instead of the current version ofsource <(...)
which does not work when the POSIX mode is turned on in Bash <= 5.0. I have added a detailed explanation in the code comments.Motivation and Context
In Bash 5.0 and below(edit: After I submitted this PR, #5735 introduced the approach usingPS0
for Bash 4.4 and above, so the problem arises only in Bash 4.3 and below as of 2024-04-01), Starship initialization failed when the POSIX mode is turned on. This PR fixes the issue.Closes #1674
Closes #3660
Closes #5382
Screenshots (if appropriate):
With the following
bashrc
:Before the fix:
After the fix:
How Has This Been Tested?
Checklist:
There doesn't seem to be any documentation about the internal implementation of the original approach
<(...)
, so I judged we do not have to add documentation for the new approach either.I'm not familiar with Rust, but
cargo check
just seems to pass.