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

Says OK! $HOME/.zshrc has been modified when it has not ... #1114

Open
yvan-sraka opened this issue Jul 31, 2024 · 1 comment
Open

Says OK! $HOME/.zshrc has been modified when it has not ... #1114

yvan-sraka opened this issue Jul 31, 2024 · 1 comment

Comments

@yvan-sraka
Copy link

sed: /nix/store/l6qcyh3xs1a5c7hcwlp75vf32w4k3wmx-hm_.zshrc: Permission denied
main: line 598: /Users/yvan/.zshrc: Permission denied
sed: /nix/store/y9qmwhk79lkiasncpkh10afg586zpkm8-profile: Permission denied
main: line 603: /Users/yvan/.profile: Permission denied

===============================================================================

OK! /Users/yvan/.zshrc has been modified. Restart your terminal for the changes to take effect,
or type ". /Users/yvan/.ghcup/env" to apply them in your current terminal session.

===============================================================================

Editing ~/.zshrc (and ~/.profile) could fail (e.g. here because I use home-manager), so I believe the following code should better handle errors:

if [ -e "$HOME/.profile" ] ; then
sed -i -e '/# ghcup-env$/d' "$(posix_realpath "$HOME/.profile")"
printf "\n%s" "[ -f \"${GHCUP_DIR}/env\" ] && . \"${GHCUP_DIR}/env\" # ghcup-env" >> "$HOME/.profile"
fi
echo
echo "==============================================================================="
echo
warn "OK! ${GHCUP_PROFILE_FILE} has been modified. Restart your terminal for the changes to take effect,"
warn "or type \". ${GHCUP_DIR}/env\" to apply them in your current terminal session."
return
;;

@hasufell
Copy link
Member

Handle how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants