Skip to content

Commit 057efbc

Browse files
committed
Fix replace/replaceAll
1 parent 78d40a4 commit 057efbc

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/hooks/usePantry.getScript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function add_fixture(run: string, key: string, obj: any, tokens: { from: string,
155155

156156
const chmod_if_shebang = contents.startsWith("#!") ? `chmod +x $${fixture_key}\n` : ""
157157

158-
fixture = useMoustaches().apply(validate.str(contents), tokens).replace('$', '\\$')
158+
fixture = useMoustaches().apply(validate.str(contents), tokens).replaceAll('$', '\\$')
159159
return undent`
160160
OLD_${fixture_key}=$${fixture_key}
161161
${fixture_key}=$(mktemp)${extname ? `.${extname}` : ''}
@@ -168,7 +168,7 @@ function add_fixture(run: string, key: string, obj: any, tokens: { from: string,
168168
169169
rm -f $${fixture_key}*
170170
171-
if test -n "$${fixture_key}"; then
171+
if test -n "$OLD_${fixture_key}"; then
172172
${fixture_key}=$OLD_${fixture_key}
173173
else
174174
unset ${fixture_key}

projects/pc-cmake.com/package.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ build:
66
working-directory: '{{prefix}}/lib/pkgconfig'
77
- run: echo "{{prefix}}" >pc-cmake-targets.cmake
88
working-directory: '{{prefix}}/lib/cmake/pc-cmake'
9-
- run: |
10-
if $(sh $PROP) = $(dirname $0); then
11-
exit 1
12-
fi
9+
# testing dollar escaping
10+
- |
11+
FOO=1
12+
BAR=2
13+
export BAZ=3
14+
- run:
15+
test $(sh $PROP) = --3
1316
prop: |
14-
echo $(dirname $0)
17+
echo $FOO-$BAR-$BAZ
1518
1619
test:
1720
- test "$(cat {{prefix}}/lib/pkgconfig/pc-cmake.pc)" = '${pcfiledir}/../..'

0 commit comments

Comments
 (0)