Skip to content

Commit b60d930

Browse files
committed
Remove the trap from virtualenvwrapper_tempfile; the function is called in
a command substitution, so the trap fires immediately to remove the file. There are ways to accomplish this, but they're complex and the caller is already explicitly rm'ing the file. diff --git a/virtualenvwrapper.sh b/virtualenvwrapper.sh --- a/virtualenvwrapper.sh +++ b/virtualenvwrapper.sh @@ -130,25 +130,24 @@ function virtualenvwrapper_verify_workon function virtualenvwrapper_tempfile {
1 parent 92d2655 commit b60d930

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

tests/test_tempfile.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ setUp () {
2424
test_tempfile () {
2525
filename=$(virtualenvwrapper_tempfile hook)
2626
assertTrue "Filename is empty" "[ ! -z \"$filename\" ]"
27+
assertTrue "File doesn't exist" "[ -f \"$filename\" ]"
2728
rm -f $filename
2829
comparable_tmpdir=$(echo $tmplocation | sed 's|/$||')
2930
comparable_dirname=$(dirname $filename | sed 's|/$||')

virtualenvwrapper.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ function virtualenvwrapper_tempfile {
136136
echo "ERROR: virtualenvwrapper could not create a temporary file name." 1>&2
137137
return 1
138138
fi
139-
trap "\rm -f '$file' >/dev/null 2>&1" EXIT
140139
echo $file
141140
return 0
142141
}

0 commit comments

Comments
 (0)