Skip to content

Commit

Permalink
Improve path resolution in gsudo wrapper for git-bash/MinGW.
Browse files Browse the repository at this point in the history
- Use `dirname` and `readlink` to accurately determine the location of gsudo.exe

Fixes #337
  • Loading branch information
gerardog committed Feb 19, 2024
1 parent 8b132b0 commit 3b68538
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gsudo.Wrappers/gsudo
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
# For better experience (fix credentials cache) in git-bash/MinGw create this wrapper can be added as function in .bashrc:
# gsudo() { WSLENV=WSL_DISTRO_NAME:USER:$WSLENV MSYS_NO_PATHCONV=1 gsudo.exe "$@"; }

WSLENV=WSL_DISTRO_NAME:USER:$WSLENV MSYS_NO_PATHCONV=1 "$( dirname -- "$0")/gsudo.exe" "$@"
thisdir="$(dirname "$(readlink "$0")")"
WSLENV=WSL_DISTRO_NAME:USER:$WSLENV MSYS_NO_PATHCONV=1 "${thisdir}/gsudo.exe" "$@"

0 comments on commit 3b68538

Please sign in to comment.