Skip to content

Commit b56a972

Browse files
authored
Merge pull request #9 from Cyber1000/master
Smaller improvements - speedup
2 parents 101528b + 844b32d commit b56a972

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

runx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ getwslpath() { # Get path to currently running WSL system
237237
# Mark our filesystem with a temporary file having an unique name.
238238
touch "${RUN_ID}"
239239

240-
powershell.exe -Command '(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}).BasePath.replace(":", "").replace("\", "/")' | while IFS= read -r BASEPATH; do
240+
powershell.exe -Command '(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}).BasePath | where-object {$_ -ne $null} | ForEach-Object { $_.replace(":", "").replace("\", "/") }' | while IFS= read -r BASEPATH; do
241241
# Remove trailing whitespaces.
242242
BASEPATH="${BASEPATH%"${BASEPATH##*[![:space:]]}"}"
243243
# Build the path on WSL.
@@ -287,7 +287,7 @@ check_display() { # Find unused display number
287287
return 1
288288
}
289289
check_displayport() { # Return 0 if display number $1 is in use
290-
(</dev/tcp/"$Hostip"/$((6000+${1:-})) ) >/dev/null 2>&1
290+
timeout 1 bash -c "</dev/tcp/"$Hostip"/$((6000+${1:-})) >/dev/null 2>&1" && return 0 || return 1
291291
}
292292
check_host() { # Check host environment
293293
# Check for MS Windows subsystem
@@ -351,7 +351,7 @@ check_xserver() { # Check for Xwin and VcXsrv
351351
Vcxsrvbin="$(command -v vcxsrv.exe)"
352352
[ "$Vcxsrvbin" ] || Vcxsrvbin="$(command -v "$(convertpath subsystem "C:/Program Files/VcXsrv/vcxsrv.exe")")"
353353
[ "$Vcxsrvbin" ] || Vcxsrvbin="$(command -v "$(convertpath subsystem "C:/Program Files/VcXsrv (x86)/vcxsrv.exe")")"
354-
Xwinbin="$(command -v XWin)"
354+
Xwinbin="$(command -v XWin)" || Xwinbin="$(command -v XWin.exe)"
355355
[ -z "$Xwinbin" ] && case $Winsubsystem in
356356
WSL1|WSL2)
357357
# search for XWin

0 commit comments

Comments
 (0)