Show More
@@ -269,9 +269,10 b' def shelltocmdexe(path, env):' | |||||
269 | >>> # Single quote prevents expansion, as does \$ escaping |
|
269 | >>> # Single quote prevents expansion, as does \$ escaping | |
270 | >>> shelltocmdexe(b"cmd '$var1 ${var2} %var3%' \$var1 \${var2} \\", e) |
|
270 | >>> shelltocmdexe(b"cmd '$var1 ${var2} %var3%' \$var1 \${var2} \\", e) | |
271 | "cmd '$var1 ${var2} %var3%' $var1 ${var2} \\" |
|
271 | "cmd '$var1 ${var2} %var3%' $var1 ${var2} \\" | |
272 |
>>> # $$ |
|
272 | >>> # $$ is not special. %% is not special either, but can be the end and | |
|
273 | >>> # start of consecutive variables | |||
273 | >>> shelltocmdexe(b"cmd $$ %% %var1%%var2%", e) |
|
274 | >>> shelltocmdexe(b"cmd $$ %% %var1%%var2%", e) | |
274 | 'cmd $ %% %var1%%var2%' |
|
275 | 'cmd $$ %% %var1%%var2%' | |
275 | >>> # No double substitution |
|
276 | >>> # No double substitution | |
276 | >>> shelltocmdexe(b"$var1 %var1%", {b'var1': b'%var2%', b'var2': b'boom'}) |
|
277 | >>> shelltocmdexe(b"$var1 %var1%", {b'var1': b'%var2%', b'var2': b'boom'}) | |
277 | '%var1% %var1%' |
|
278 | '%var1% %var1%' | |
@@ -306,11 +307,8 b' def shelltocmdexe(path, env):' | |||||
306 | else: |
|
307 | else: | |
307 | var = path[:index] |
|
308 | var = path[:index] | |
308 | res += b'%' + var + b'%' |
|
309 | res += b'%' + var + b'%' | |
309 |
elif c == b'$': # variable |
|
310 | elif c == b'$': # variable | |
310 |
if path[index + 1:index + 2] == b' |
|
311 | if path[index + 1:index + 2] == b'{': | |
311 | res += c |
|
|||
312 | index += 1 |
|
|||
313 | elif path[index + 1:index + 2] == b'{': |
|
|||
314 | path = path[index + 2:] |
|
312 | path = path[index + 2:] | |
315 | pathlen = len(path) |
|
313 | pathlen = len(path) | |
316 | try: |
|
314 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now