Skip to content

Commit

Permalink
Fix replace/replaceAll
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Dec 26, 2023
1 parent 78d40a4 commit df0b0dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/hooks/usePantry.getScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}` : ''}
Expand All @@ -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}
Expand Down
13 changes: 8 additions & 5 deletions projects/pc-cmake.com/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}/../..'
Expand Down

0 comments on commit df0b0dd

Please sign in to comment.