Skip to content

Commit

Permalink
escape __VIRTUAL_ENV__ path.
Browse files Browse the repository at this point in the history
Fixes issue pypa/virtualenv#53 in bash and shell by using the printf %q "shell quote" formatter, which escapes as appropriate for a given environment. Falls back to quoting some characters that universally need to be escaped. Fallback is needed because there are several printf implementations, not all of which are guaranteed to have the %q formatter (though bash always should).
  • Loading branch information
davidbstein committed Oct 18, 2015
1 parent 54dddd8 commit 0bc6629
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion activate.sh
Expand Up @@ -39,7 +39,8 @@ deactivate () {
# unset irrelevant variables
deactivate nondestructive

VIRTUAL_ENV="__VIRTUAL_ENV__"
VIRTUAL_ENV=$(printf %q "__VIRTUAL_ENV__") || VIRTUAL_ENV=$(echo "__VIRTUAL_ENV__" | sed 's/[ ()$;]/\\&/g')

export VIRTUAL_ENV

_OLD_VIRTUAL_PATH="$PATH"
Expand Down

0 comments on commit 0bc6629

Please sign in to comment.