[New] `install.sh`: Parallel script download jobs

Peter Dave Hello 2017-04-05 04:54:38 +08:00 committed by Jordan Harband
parent c6866eeb37
commit ec3ba1973a
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 6 additions and 2 deletions

View File

@ -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