diff --git a/cylc/flow/scripts/cylc.py b/cylc/flow/scripts/cylc.py index cabcec553e9..4ca411f8e9b 100644 --- a/cylc/flow/scripts/cylc.py +++ b/cylc/flow/scripts/cylc.py @@ -88,7 +88,7 @@ def get_version(long=False): from pathlib import Path version = f"{__version__}" if long: - version += f" ({Path(sys.executable).parent.parent})" + version += f" ({Path(sys.argv[0])})" return version diff --git a/tests/functional/cli/01-help.t b/tests/functional/cli/01-help.t index 935864e1873..b8f1bd38583 100755 --- a/tests/functional/cli/01-help.t +++ b/tests/functional/cli/01-help.t @@ -79,12 +79,7 @@ run_ok "${TEST_NAME_BASE}-id" cylc help id # Check "cylc version --long" output is correct. cylc version --long | head -n 1 > long1 -WHICH="$(command -v cylc)" -PARENT1="$(dirname "${WHICH}")" -PARENT2="$(dirname "${PARENT1}")" -echo "$(cylc version) (${PARENT2})" > long2 -# the concise version of the above is a bash quoting nightmare: -# echo "$(cylc version) ($(dirname $(dirname $(which cylc))))" > long2 +echo "$(cylc version) ($(command -v cylc))" > long2 cmp_ok long1 long2 # --help with no DISPLAY