Skip to content

Commit e7c988e

Browse files
committed
check exit code of virtualenv before proceeding (fixes #56)
1 parent 201ed58 commit e7c988e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tests/test_mkvirtualenv.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ test_no_virtualenv () {
6767
assertSame "$RC" "1"
6868
}
6969

70+
test_no_args () {
71+
mkvirtualenv 2>/dev/null 1>&2
72+
RC=$?
73+
assertSame "2" "$RC"
74+
}
75+
7076
test_no_workon_home () {
7177
old_home="$WORKON_HOME"
7278
export WORKON_HOME="$WORKON_HOME/not_there"

virtualenvwrapper.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ mkvirtualenv () {
197197
virtualenv "$@" &&
198198
[ -d "$WORKON_HOME/$envname" ] && virtualenvwrapper_run_hook "pre_mkvirtualenv" "$envname"
199199
)
200+
typeset RC=$?
201+
[ $RC -ne 0 ] && return $RC
200202
# If they passed a help option or got an error from virtualenv,
201203
# the environment won't exist. Use that to tell whether
202204
# we should switch to the environment and run the hook.

0 commit comments

Comments
 (0)