Skip to content

Commit 515d9eb

Browse files
committed
Clean up the temporary file in the virtualenvwrapper_run_hook error returns.
1 parent 2d02918 commit 515d9eb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

virtualenvwrapper.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ function virtualenvwrapper_run_hook {
152152
if [ -z "$VIRTUALENVWRAPPER_LOG_DIR" ]
153153
then
154154
echo "ERROR: VIRTUALENVWRAPPER_LOG_DIR is not set." 1>&2
155+
\rm -f "$hook_script"
155156
return 1
156157
fi
157158
"$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' $HOOK_VERBOSE_OPTION --script "$hook_script" "$@"
@@ -162,12 +163,13 @@ function virtualenvwrapper_run_hook {
162163
if [ ! -f "$hook_script" ]
163164
then
164165
echo "ERROR: virtualenvwrapper_run_hook could not find temporary file $hook_script" 1>&2
166+
\rm -f "$hook_script"
165167
return 2
166168
fi
167169
# cat "$hook_script"
168170
source "$hook_script"
169171
fi
170-
\rm -f "$hook_script" >/dev/null 2>&1
172+
\rm -f "$hook_script"
171173
return $result
172174
}
173175

0 commit comments

Comments
 (0)