From c49029afecf85fda829d8c6c7f1b5f7b8bc3f7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20Szigeti?= Date: Mon, 9 Oct 2023 00:22:28 +0200 Subject: [PATCH] Fix finding composer cache dir (#233) --- bin/composer_paths.sh | 2 +- tests/expect/composer_paths_10.exp | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 tests/expect/composer_paths_10.exp diff --git a/bin/composer_paths.sh b/bin/composer_paths.sh index 4d96a68..decf725 100755 --- a/bin/composer_paths.sh +++ b/bin/composer_paths.sh @@ -46,7 +46,7 @@ if [ ! -f "${composer_lock}" ]; then fi composer_version="$($composer_path --version)" -cache_dir="$($composer_path config cache-dir)" +cache_dir="$($composer_path --working-dir="${working_directory}" config cache-dir)" echo "::debug::Composer path is '${composer_path}'" echo "::debug::${composer_version}" diff --git a/tests/expect/composer_paths_10.exp b/tests/expect/composer_paths_10.exp new file mode 100755 index 0000000..3c950f7 --- /dev/null +++ b/tests/expect/composer_paths_10.exp @@ -0,0 +1,15 @@ +#!/usr/bin/env -S expect -f + +set timeout 3 +# So we don't find a composer.lock in current dir +cd .. +spawn ../bin/composer_paths.sh "" "fixtures/with-lock-file" +match_max 100000 + +expect "::debug::Composer path is '*'\r +::debug::Composer version *\r +::debug::Composer cache directory found at '*composer*'\r +::debug::File composer.json found at 'fixtures/with-lock-file/composer.json'\r +::debug::File composer.lock path computed as 'fixtures/with-lock-file/composer.lock'\r +" +expect eof