From df0b0dd9889fa1c02200ac84a77d22bca0457644 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Tue, 26 Dec 2023 08:27:48 +0000 Subject: [PATCH] Fix replace/replaceAll --- lib/hooks/usePantry.getScript.ts | 4 ++-- projects/pc-cmake.com/package.yml | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/hooks/usePantry.getScript.ts b/lib/hooks/usePantry.getScript.ts index feabfb6c..4b560a25 100644 --- a/lib/hooks/usePantry.getScript.ts +++ b/lib/hooks/usePantry.getScript.ts @@ -155,7 +155,7 @@ function add_fixture(run: string, key: string, obj: any, tokens: { from: string, const chmod_if_shebang = contents.startsWith("#!") ? `chmod +x $${fixture_key}\n` : "" - fixture = useMoustaches().apply(validate.str(contents), tokens).replace('$', '\\$') + fixture = useMoustaches().apply(validate.str(contents), tokens).replaceAll('$', '\\$') return undent` OLD_${fixture_key}=$${fixture_key} ${fixture_key}=$(mktemp)${extname ? `.${extname}` : ''} @@ -168,7 +168,7 @@ function add_fixture(run: string, key: string, obj: any, tokens: { from: string, rm -f $${fixture_key}* - if test -n "$${fixture_key}"; then + if test -n "$OLD_${fixture_key}"; then ${fixture_key}=$OLD_${fixture_key} else unset ${fixture_key} diff --git a/projects/pc-cmake.com/package.yml b/projects/pc-cmake.com/package.yml index 57a0cd15..986adff0 100644 --- a/projects/pc-cmake.com/package.yml +++ b/projects/pc-cmake.com/package.yml @@ -6,12 +6,15 @@ build: working-directory: '{{prefix}}/lib/pkgconfig' - run: echo "{{prefix}}" >pc-cmake-targets.cmake working-directory: '{{prefix}}/lib/cmake/pc-cmake' - - run: | - if $(sh $PROP) = $(dirname $0); then - exit 1 - fi + # testing dollar escaping + - | + FOO=1 + BAR=2 + export BAZ=3 + - run: + test $(sh $PROP) = --3 prop: | - echo $(dirname $0) + echo $FOO-$BAR-$BAZ test: - test "$(cat {{prefix}}/lib/pkgconfig/pc-cmake.pc)" = '${pcfiledir}/../..'