Skip to content

Commit ea7ce73

Browse files
rqptrq
and
rq
authored
fix: Use xdg-open if open does not exist (#744)
Open is a macos tool. On linux systems, xdg-open is commonly used instead. Co-authored-by: rq <ernstvermeulen@proton.me>
1 parent 9f3fea5 commit ea7ce73

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

bin/sail

+10-1
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,15 @@ elif [ "$1" == "share" ]; then
561561
elif [ "$1" == "open" ]; then
562562
shift 1
563563

564+
if command -v open &>/dev/null; then
565+
OPEN="open"
566+
elif command -v xdg-open &>/dev/null; then
567+
OPEN="xdg-open"
568+
else
569+
echo "Neither open nor xdg-open is available. Exiting."
570+
exit 1
571+
fi
572+
564573
if [ "$EXEC" == "yes" ]; then
565574

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

572-
open "$FULL_URL"
581+
$OPEN "$FULL_URL"
573582

574583
exit
575584
else

0 commit comments

Comments
 (0)