Commits

Doug Hellmann committed 25d0c35

more tempfile fixes

Comments (0)

Files changed (3)

 2010-05-16  Doug Hellmann  <dhellmann@racemi.com>
 
+	* virtualenvwrapper.sh (virtualenvwrapper_tempfile): Set a default
+	suffix of "hook" and explicitly report when we detect an error
+	condition.
+
 	* Makefile (PYTHON26): Use which to find python2.6, the default
 	interpreter, so we can run the tests as "make test-quick" on other
 	hosts.
 
 export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
 
+unset HOOK_VERBOSE_OPTION
+
 setUp () {
     rm -rf "$WORKON_HOME"
     mkdir -p "$WORKON_HOME"
 # Expects 1 argument, the suffix for the new file.
 virtualenvwrapper_tempfile () {
     # Note: the 'X's must come last
-    mktemp -t "virtualenvwrapper-$1-XXXXXX"
+    typeset suffix=${1:-hook}
+    mktemp -t "virtualenvwrapper-$suffix-XXXXXXXXXX"
+    if [ $? -ne 0 ]
+    then
+        echo "ERROR: virtualenvwrapper could not create a temporary file name." 1>&2
+        return 1
+    fi
+    return 0
 }
 
 # Run the hooks