Skip to content

Commit f65a75f

Browse files
committed
more tempfile fixes
1 parent 0b1d952 commit f65a75f

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
2010-05-16 Doug Hellmann <[email protected]>
22

3+
* virtualenvwrapper.sh (virtualenvwrapper_tempfile): Set a default
4+
suffix of "hook" and explicitly report when we detect an error
5+
condition.
6+
37
* Makefile (PYTHON26): Use which to find python2.6, the default
48
interpreter, so we can run the tests as "make test-quick" on other
59
hosts.

tests/test_cp.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ test_dir=$(dirname $0)
66

77
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
88

9+
unset HOOK_VERBOSE_OPTION
10+
911
setUp () {
1012
rm -rf "$WORKON_HOME"
1113
mkdir -p "$WORKON_HOME"

virtualenvwrapper.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ virtualenvwrapper_verify_workon_home () {
9393
# Expects 1 argument, the suffix for the new file.
9494
virtualenvwrapper_tempfile () {
9595
# Note: the 'X's must come last
96-
mktemp -t "virtualenvwrapper-$1-XXXXXX"
96+
typeset suffix=${1:-hook}
97+
mktemp -t "virtualenvwrapper-$suffix-XXXXXXXXXX"
98+
if [ $? -ne 0 ]
99+
then
100+
echo "ERROR: virtualenvwrapper could not create a temporary file name." 1>&2
101+
return 1
102+
fi
103+
return 0
97104
}
98105

99106
# Run the hooks

0 commit comments

Comments
 (0)