Skip to content

Commit 80cb341

Browse files
ffespaulirish
authored andcommitted
Add support for WSL (#101)
1 parent 07d75b2 commit 80cb341

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

git-open

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,17 @@ fi
105105

106106
# get current open browser command
107107
case $( uname -s ) in
108-
Darwin) open='open';;
109-
MINGW*) open='start';;
110-
MSYS*) open='start';;
111-
CYGWIN*) open='cygstart';;
112-
*) open='xdg-open';;
108+
Darwin) open='open';;
109+
MINGW*) open='start';;
110+
MSYS*) open='start';;
111+
CYGWIN*) open='cygstart';;
112+
*) # Try to detect WSL (Windows Subsystem for Linux)
113+
if uname -r | grep -q Microsoft; then
114+
open='powershell.exe'
115+
openopt='Start'
116+
else
117+
open='xdg-open'
118+
fi;;
113119
esac
114120

115121
# Allow printing the url if BROWSER=echo
@@ -118,4 +124,4 @@ if [[ $BROWSER != "echo" ]]; then
118124
fi
119125

120126
# open it in a browser
121-
${BROWSER:-$open} "$openurl"
127+
${BROWSER:-$open} $openopt "$openurl"

0 commit comments

Comments
 (0)