summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2023-03-03 12:34:31 +0100
committerGitHub <noreply@github.com>2023-03-03 12:34:31 +0100
commit5bf7f9c83325a6cb2752e14ca01a574dbeef206e (patch)
treed5585681864563dd4242b920b5d0de6f21f5c9bb /lib
parent14978859c5b8d9385c9b836cd09c97cc08b6035b (diff)
downloadzsh-5bf7f9c83325a6cb2752e14ca01a574dbeef206e.tar.gz
zsh-5bf7f9c83325a6cb2752e14ca01a574dbeef206e.tar.bz2
zsh-5bf7f9c83325a6cb2752e14ca01a574dbeef206e.zip
fix(lib): use `$BROWSER` in `open_command` if set (#11532)
Fixes #11098
Diffstat (limited to 'lib')
-rw-r--r--lib/functions.zsh7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/functions.zsh b/lib/functions.zsh
index 6e1faa6aa..1d85ea38a 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -30,6 +30,13 @@ function open_command() {
;;
esac
+ # If a URL is passed, $BROWSER might be set to a local browser within SSH.
+ # See https://github.com/ohmyzsh/ohmyzsh/issues/11098
+ if [[ -n "$BROWSER" && "$1" = (http|https)://* ]]; then
+ "$BROWSER" "$@"
+ return
+ fi
+
${=open_cmd} "$@" &>/dev/null
}