浏览代码

fix(lib): use `$BROWSER` in `open_command` if set (#11532)

Fixes #11098
Marc Cornellà 1 年之前
父节点
当前提交
5bf7f9c833
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      lib/functions.zsh

+ 7 - 0
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
 }