From 07b169ec32ad6961ed8625a0b932a663abcb01d2 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Sun, 19 Apr 2020 18:55:05 -0400 Subject: platform/darwin: don't invoke brew for the default prefix "brew --prefix gnu-getopt" takes 2.125s on my very default setup (I don't even want to know why), dominating the pass wall time. If the default brew prefix is in use, just detect the getopt binary with a cheap "test -x" instead. --- src/platform/darwin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh index 1222040..f6cc471 100644 --- a/src/platform/darwin.sh +++ b/src/platform/darwin.sh @@ -39,6 +39,6 @@ qrcode() { fi } -GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt" +GETOPT="$({ test -x /usr/local/opt/gnu-getopt/bin/getopt && echo /usr/local/opt/gnu-getopt; } || brew --prefix gnu-getopt 2>/dev/null || { which port &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt" SHRED="srm -f -z" BASE64="openssl base64" -- cgit v1.2.3