From 562f9ecb5fc1e0fc30905fedf96d19833d6ed976 Mon Sep 17 00:00:00 2001 From: Yazhong Liu Date: Fri, 6 Jun 2014 14:09:39 +0800 Subject: [PATCH] fix #177, add a lock file for n --- bin/n | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/n b/bin/n index f95bd88..25bdfd6 100755 --- a/bin/n +++ b/bin/n @@ -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)