Skip to content

Commit

Permalink
fix: Use xdg-open if open does not exist (#744)
Browse files Browse the repository at this point in the history
Open is a macos tool. On linux systems, xdg-open is commonly used
instead.

Co-authored-by: rq <[email protected]>
  • Loading branch information
rqpt and rq authored Nov 1, 2024
1 parent 9f3fea5 commit ea7ce73
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bin/sail
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,15 @@ elif [ "$1" == "share" ]; then
elif [ "$1" == "open" ]; then
shift 1

if command -v open &>/dev/null; then
OPEN="open"
elif command -v xdg-open &>/dev/null; then
OPEN="xdg-open"
else
echo "Neither open nor xdg-open is available. Exiting."
exit 1
fi

if [ "$EXEC" == "yes" ]; then

if [[ -n "$APP_PORT" && "$APP_PORT" != "80" ]]; then
Expand All @@ -569,7 +578,7 @@ elif [ "$1" == "open" ]; then
FULL_URL="$APP_URL"
fi

open "$FULL_URL"
$OPEN "$FULL_URL"

exit
else
Expand Down

0 comments on commit ea7ce73

Please sign in to comment.