Skip to content

Commit

Permalink
Prevent removing the currently active version of Node.js/io.js
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrimue committed Aug 15, 2015
1 parent 62d0d54 commit 42ae0c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions bin/n
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Setup.
#

VERSION="1.4.0"
VERSION="1.4.2"
UP=$'\033[A'
DOWN=$'\033[B'
N_PREFIX=${N_PREFIX-/usr/local}
Expand Down Expand Up @@ -483,8 +483,11 @@ set_quiet() {

remove_versions() {
test -z $1 && abort "version(s) required"
check_current_version
while test $# -ne 0; do
rm -rf ${VERSIONS_DIR[$DEFAULT]}/${1#v}
local version=${1#v}
[ "${BINS[$DEFAULT]}/$version" == "$active" ] && abort "cannot remove currently active version ($active)"
rm -rf ${VERSIONS_DIR[$DEFAULT]}/$version
shift
done
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "n",
"description": "node version manager",
"version": "1.4.1",
"version": "1.4.2",
"author": "TJ Holowaychuk <[email protected]>",
"homepage": "https://github.com/tj/n",
"bugs": "https://github.com/tj/n/issues",
Expand Down

0 comments on commit 42ae0c8

Please sign in to comment.