-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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(main/zsh): Fix zsh-newuser-install being run twice #20787
Conversation
Zsh already automatically runs zsh-newuser-install as part of the `newuser` module. Running it manually in the system zshrc caused it to run twice.
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.
Good catch.
Do you happen to have a source for that, because that might explain how I missed this initially. |
Yes, here is a link to the check on the unofficial GitHub Zsh mirror: https://github.com/zsh-users/zsh/blob/master/Functions/Newuser/zsh-newuser-install#L114 I found this while I was debugging why it was running in an SSH environment but not in a normal Termux session. |
Okay so if |
It is probably the reason why @gphg had trouble bringing the wizard up in #20604 (comment). |
Hmm maybe a notice would be good if that condition applies? Something along the lines of: # if zsh-newuser-install doesn't consider the terminal size "sane"
if (( ${LINES:-0} < 15 || ${COLUMNS:-0} < 72 )); then
# and no ~/.zshrc exists
[[ -r "${ZDOTDIR:-$HOME}"/.zshrc ]] || printf '%s\n' \
'No ~/.zshrc exists' \
'and zsh-newuser-install was not able to run.' \
'Please consider zooming out by pinching' \
'to increase the terminal size' \
'and running zsh-newuser-install manually.' \
'For first-run setup.' \
fi |
I think handling that situation should be solved on upstream because it is not a Termux-specific issue. As for the implementation itself, we do not need to check if Maybe something like this (considering how the other checks are handled): # Don't run unless terminal is sane.
if (( ${LINES:-0} < 15 || ${COLUMNS:-0} < 72 )); then
if [[ $1 = -f ]]; then
print -r "$myname: terminal size too small (less than 72x15)." >&2
fi
return 1
fi |
Well if a But yeah you're right, that's probably for upstream to work out. |
Oh congrats, you won the commit hash lottery. |
Yes, but if But it might not hurt to add a post-install script that notifies users of the terminal size issue. |
LGTM. I was work remotely at that time, I didn't notice it. |
Zsh already automatically runs
zsh-newuser-install
as part of thenewuser
module. Running it manually in the systemzshrc
caused it to run twice.Note that
zsh-newuser-install
automatically exits if the terminal's size is less than72x15
, so it might not run on the default Termux terminal size.