0
0
mirror of https://github.com/tj/n.git synced 2024-11-29 05:42:48 +01:00

fix #177, add a lock file for n

This commit is contained in:
Yazhong Liu 2014-06-06 14:09:39 +08:00
parent 69c16e4eeb
commit 562f9ecb5f

9
bin/n
View File

@ -294,8 +294,10 @@ install_node() {
local url=$(tarball_url $version)
if test -d $dir; then
activate $version
exit
if [[ ! -e $dir/n.lock ]] ; then
activate $version
exit
fi
fi
echo
@ -307,6 +309,8 @@ install_node() {
mkdir -p $dir
if [ $? -ne 0 ] ; then
abort "sudo required"
else
touch $dir/n.lock
fi
cd $dir
@ -314,6 +318,7 @@ install_node() {
log fetch $url
curl -L# $url | tar -zx --strip 1
erase_line
rm -f $dir/n.lock
activate $version
log installed $(node --version)