From 56679d477628db69be7b3ceb1ebcabb5cff739b6 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 26 Oct 2016 15:48:42 +0200 Subject: [PATCH] Don't use open function if a command exists Turns out this is also the case on Haiku. It also eliminates a fork. Closes #3487. --- doc_src/open.txt | 2 ++ share/functions/open.fish | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc_src/open.txt b/doc_src/open.txt index c81c3c9a1..7207fc172 100644 --- a/doc_src/open.txt +++ b/doc_src/open.txt @@ -9,6 +9,8 @@ open FILES... `open` opens a file in its default application, using the appropriate tool for the operating system. On GNU/Linux, this requires the common but optional `xdg-open` utility, from the `xdg-utils` package. +Note that this function will not be used if a command by this name exists (which is the case on macOS or Haiku). + \subsection open-example Example diff --git a/share/functions/open.fish b/share/functions/open.fish index 533b3df19..9eaa7eda6 100644 --- a/share/functions/open.fish +++ b/share/functions/open.fish @@ -3,7 +3,7 @@ # application for the file. # -if not test (uname) = Darwin +if not command -s open >/dev/null function open --description "Open file in default application" if count $argv >/dev/null switch $argv[1]