From ec3ba1973a403e941e479549e8bb354182d19a31 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Wed, 5 Apr 2017 04:54:38 +0800 Subject: [PATCH] [New] `install.sh`: Parallel script download jobs --- install.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 3b54c66..084e442 100755 --- a/install.sh +++ b/install.sh @@ -172,11 +172,15 @@ install_nvm_as_script() { nvm_download -s "$NVM_SOURCE_LOCAL" -o "$INSTALL_DIR/nvm.sh" || { echo >&2 "Failed to download '$NVM_SOURCE_LOCAL'" return 1 - } + } & nvm_download -s "$NVM_EXEC_SOURCE" -o "$INSTALL_DIR/nvm-exec" || { echo >&2 "Failed to download '$NVM_EXEC_SOURCE'" return 2 - } + } & + for job in $(jobs -p | sort) + do + wait "$job" || return $? + done chmod a+x "$INSTALL_DIR/nvm-exec" || { echo >&2 "Failed to mark '$INSTALL_DIR/nvm-exec' as executable" return 3