Skip to content

Commit

Permalink
use convertpath() less often for $Xcookie #7
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Aug 17, 2022
1 parent a63b07b commit 2c69bfa
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions runx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash
# runx: Provide an X server in Cygwin, MSYS2 or WSL.

Version="v0.4.14"
Version="v0.4.15"

usage() { # Usage information (--help)
echo "runx - Run Linux GUI applications on MS Windows.
Expand Down Expand Up @@ -467,8 +467,8 @@ generate_xcommand() { # Generate command to start X server VcXsrv
case $Xauthentication in
yes)
case "$Xserver" in
xwin) Xcommand="$Xcommand -auth '$(convertpath subsystem "$Xcookie")'" ;;
vcxsrv) Xcommand="$Xcommand -auth '$(convertpath windows "$Xcookie")'" ;;
xwin) Xcommand="$Xcommand -auth '$Xcookie'" ;;
vcxsrv) Xcommand="$Xcommand -auth '$(convertpath windows "$Xcookie")'" ;;
esac ;;
no) Xcommand="$Xcommand -ac" ;;
esac
Expand Down Expand Up @@ -496,12 +496,12 @@ setup_cookie() { # Generate X authentication cookie
command -v tasklist.exe >/dev/null && {
tasklist.exe | rmcr | grep -q -E 'vcxsrv.exe|XWin.exe' || {
verbose "Removing old cookies."
[ -e "$(convertpath subsystem "$Xcookie")" ] && rm "$(convertpath subsystem "$Xcookie")"
[ -e "$Xcookie" ] && rm "$Xcookie"
}
}

# avoid missing file message of xauth
touch "$(convertpath subsystem "$Xcookie")"
touch "$Xcookie"

# check for native xauth, otherwise use xauth.exe from VcXsrv
Xauthbin="$(command -v xauth)"
Expand Down Expand Up @@ -536,7 +536,7 @@ $Xauthbin \"$@\"
https://github.com/mviereck/runx/issues/7
If it fails, you can use option --no-auth as a workaround."
cookiebaker $Hostip:$Newdisplaynumber > $Xcookie.tmp
cat $Xcookie.tmp >> "$(convertpath subsystem "$Xcookie")"
cat $Xcookie.tmp >> "$Xcookie"
rm $Xcookie.tmp
}
}
Expand Down Expand Up @@ -599,7 +599,7 @@ cleanup() { # --cleanup: Terminate X servers, delete cookies
MSYS2_ARG_CONV_EXCL='*' taskkill.exe /F /PID xwin.exe
# Remove cookies
Newdisplaynumber=0
rm -v "$(convertpath subsystem "$Xcookie")"
rm -v "$Xcookie"
}

### main
Expand Down Expand Up @@ -739,7 +739,7 @@ main() {
Xcookie="$(convertpath subsystem "$(MSYS2_ARG_CONV_EXCL='*' cmd.exe /C "echo %userprofile%")" | rmcr)/Xauthority.runx"
case "$Xauthentication" in
yes)
XAUTHORITY="$(convertpath subsystem "$Xcookie")"
XAUTHORITY="$Xcookie"
verbose "DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY"
note "If you get application error messages like 'Cannot open display'
or 'Invalid MIT-MAGIC-COOKIE', the X authentication cookie might be broken.
Expand Down

0 comments on commit 2c69bfa

Please sign in to comment.