Hugo Lopes Tavares avatar Hugo Lopes Tavares committed 19f4d0f

only show output from hook if it fails

Comments (0)

Files changed (1)

virtualenvwrapper.sh

 virtualenvwrapper_verify_workon_home () {
     if [ ! -d "$WORKON_HOME" ]
     then
-        [ "$1" != "-q" ] && echo "NOTE: Virtual environments directory '$WORKON_HOME' does not exist.  Creating..." 1>&2
+        [ "$1" != "-q" ] && echo "NOTE: '$WORKON_HOME' does not exist. Creating it at $WORKON_HOME ..." 1>&2
         mkdir $WORKON_HOME
     fi
     return 0
         echo "ERROR: Could not create temporary file name. Make sure TMPDIR is set." 1>&2
         return 1
     fi
-    "$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' $HOOK_VERBOSE_OPTION --script "$hook_script" "$@"
+    output=$("$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' $HOOK_VERBOSE_OPTION --script "$hook_script" "$@" 2>&1)
     result=$?
     
     if [ $result -eq 0 ]
             return 2
         fi
         source "$hook_script"
+    else
+        echo $output
     fi
     \rm -f "$hook_script" >/dev/null 2>&1
     return $result
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.