fix false positive getopt failure with multiple getopt matches in searched path (#4797)

* fix false positive getopt failure with multiple getopt matches in searched path

* also get launch_local_testnet

* also make_prometheus_config, called from launch_local_testnet
This commit is contained in:
tersec 2023-04-08 00:18:29 +00:00 committed by GitHub
parent 742de1347d
commit ed148ab69d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Copyright (c) 2020-2022 Status Research & Development GmbH. Licensed under
# Copyright (c) 2020-2023 Status Research & Development GmbH. Licensed under
# either of:
# - Apache License, version 2.0
# - MIT license
@ -35,7 +35,8 @@ PIDS=""
GETOPT_BINARY="getopt"
if [[ "${OS}" == "macos" ]]; then
GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null || true)
# Without the head -n1 constraint, it gets confused by multiple matches
GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null | head -n1 || true)
[[ -f "$GETOPT_BINARY" ]] || { echo "GNU getopt not installed. Please run 'brew install gnu-getopt'. Aborting."; exit 1; }
fi

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Copyright (c) 2020 Status Research & Development GmbH. Licensed under
# Copyright (c) 2020-2023 Status Research & Development GmbH. Licensed under
# either of:
# - Apache License, version 2.0
# - MIT license
@ -16,7 +16,8 @@ set -e
GETOPT_BINARY="getopt"
if uname | grep -qi darwin; then
# macOS
GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null || true)
# Without the head -n1 constraint, it gets confused by multiple matches
GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null | head -n1 || true)
[[ -f "$GETOPT_BINARY" ]] || { echo "GNU getopt not installed. Please run 'brew install gnu-getopt'. Aborting."; exit 1; }
fi

View File

@ -17,7 +17,8 @@ KILL_OLD_PROCESSES="0"
GETOPT_BINARY="getopt"
if uname | grep -qi darwin; then
# macOS
GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null || true)
# Without the head -n1 constraint, it gets confused by multiple matches
GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null | head -n1 || true)
[[ -f "$GETOPT_BINARY" ]] || { echo "GNU getopt not installed. Please run 'brew install gnu-getopt'. Aborting."; exit 1; }
fi