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

Fix: Remove shell.exists() check from get_default_terminal #2013

Merged
merged 2 commits into from
Dec 13, 2022

Conversation

ndavd
Copy link
Contributor

@ndavd ndavd commented Dec 12, 2022

Fixes #2006 by using my proposed solution #2006 (comment)

Upon inspecting https://github.com/zellij-org/zellij/blame/main/zellij-server/src/pty.rs#L451 I noticed that the reason why this is happening is because it would need to take the absolute path of the shell. My $SHELL equals zsh, when checking if a path from that exists it will return false. Now, we could just check it and set it to the fallback /bin/sh instead.. But it's not only my system that does this, a far better solution would be to perhaps use the which command to get the full path of the $SHELL output and return that instead.

@imsnif
Copy link
Member

imsnif commented Dec 12, 2022

Hey @ndavd - while I appreciate the work you've put into this, as I mentioned in my comment in the original issue, I think the best way would be to remove this conditional. We do essentially this same logic you added a little later down the line when we actually open the pane, and if there's a problem we recover from it gracefully and show an error to the user.

If you remove the if entirely (the one linked in my comment), does it work for you?

@ndavd ndavd changed the title Fix: Make sure to get full path from SHELL env Fix: Remove shell.exists() check from get_default_terminal Dec 12, 2022
@ndavd
Copy link
Contributor Author

ndavd commented Dec 12, 2022

Oh I see, that does work for me, yes. I updated the code.

@imsnif
Copy link
Member

imsnif commented Dec 12, 2022

Great! I think we can also revert the cargo.lock changes, right?

@ndavd
Copy link
Contributor Author

ndavd commented Dec 12, 2022

Yup, done!

@ndavd ndavd temporarily deployed to cachix December 12, 2022 17:13 — with GitHub Actions Inactive
@har7an har7an merged commit 8eb6446 into zellij-org:main Dec 13, 2022
har7an added a commit that referenced this pull request Dec 13, 2022
@ndavd ndavd deleted the fix/shell-path branch December 13, 2022 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thread 'pty' panicked: Cannot find shell zsh
3 participants