Skip to content

Commit

Permalink
fix(#14): portable open command
Browse files Browse the repository at this point in the history
  • Loading branch information
jannis-baum committed Aug 4, 2023
1 parent b21a5fb commit 40be8b7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion viv
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ if ! [ -f "$1" ]; then
fi
FILE=`realpath "$1"`

if [ -z "$VIV_OPEN" ]; then
which open 1>/dev/null 2>/dev/null && VIV_OPEN="open"
which xdg-open 1>/dev/null 2>/dev/null && VIV_OPEN="xdg-open"

if [ -z "$VIV_OPEN" ]; then
echo 'Please specify an "open" command in $VIV_OPEN'
exit 1
fi
fi

[ -z "$VIV_PORT" ] && VIV_PORT=31622
VIV_ADDR=http://localhost:$VIV_PORT
[ -z "$VIV_CMD" ] && VIV_CMD=vivify-server
Expand All @@ -28,4 +38,4 @@ if ! curl --fail-with-body -v $VIV_ADDR/health 1>/dev/null 2>/dev/null; then
done
fi

open $VIV_ADDR/viewer$FILE
$VIV_OPEN $VIV_ADDR/viewer$FILE

0 comments on commit 40be8b7

Please sign in to comment.