nvm
nvm copied to clipboard
Option to disable curl-like download progress
https://github.com/creationix/nvm/blob/1c3f8da6c38bdfecf3dbf01c6753a6fd27032b9d/nvm.sh#L45-L51
That section of code looks pretty messy when nvm is used in a CI system like Jenkins. Here's a small snippet of what that looks like to Jenkins' streaming console log.
...
### 5.3%
### 5.3%
### 5.3%
### 5.4%
### 5.4%
### 5.4%
### 5.4%
### 5.5%
### 5.5%
### 5.5%
#### 5.6%
#### 5.7%
#### 5.8%
#### 5.9%
#### 6.0%
#### 6.1%
#### 6.2%
#### 6.3%
#### 6.4%
#### 6.4%
#### 6.4%
#### 6.5%
#### 6.5%
#### 6.5%
#### 6.6%
#### 6.6%
#### 6.7%
#### 6.7%
#### 6.7%
#### 6.7%
#### 6.8%
#### 6.8%
#### 6.8%
#### 6.9%
##### 7.0%
##### 7.0%
##### 7.0%
##### 7.1%
##### 7.2%
##### 7.2%
##### 7.3%
##### 7.3%
##### 7.4%
...
It would be great if there was an option to disable the progress bar. While it's true I can discard output (e.g. nvm install v4.2.3 &> /dev/null
) I fear discarding potentially valuable troubleshooting output from stderr.
Totally a reasonable request. I thought there was an issue already about this but I can't find it.
nvm install
should definitely have some sort of --no-progress
argument to silence that.
Yay, I may come up with a PR this week :)
The following seems roughly equivalent for --no-progress
options.
curl -sS
wget -nv
If it's as widely supported, I'd prefer to use the double-dashed (longer, more verbose) argument names, but 👍
I don't mind using long double-dashed options. As far as wide support, I don't know. I'm using curl and wget on Mac and I know those options exist on Linux (so compatible with some form of BSD and Linux).
@samrocketman would you like to help test/review #1422?
@PeterDaveHello thanks for including me. I have given some feedback on your PR. I'll test it fully when I think it is ready.
I accidentally forgot about this issue which is why I didn't follow through on contributing a PR. Thanks for your work!
Maybe instead of (or in addition to) an option the progress should also be silenced if STDERR in not connected to the terminal, like:
if test -t 2
then
# be verbose
else
# be silent
fi
It should work for Vagrant provision script. Just an idea.
@lzrski totally separate from #1079; i think automatically silencing the progress when it's not a TTY makes sense.
Reopening; we still need to switch to no-progress
when the output isn't connected to a terminal.
It seems this feature has been in the nvm.sh
file for a year now (in the master branch), but it's not in the v0.33.11 release. Does the master branch not reflect what goes into the next release for this project?
@danielmcq you're misreading; the commit was originally authored a year ago, but it was merged 19 hours ago.
@ljharb Sorry about that. I’m just glad that it’s in there now. I can wait for it to be in the next release. 😊
Are there any updates on this? I am still experiencing this with nvm v0.34.0. It seems like the --no-progress
flag is being ignored
Click me to reveal logs.
$ export NVM_DIR=/opt/nvm
$ mkdir -p $NVM_DIR && \
$ curl -sS -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash && \
$ source $NVM_DIR/nvm.sh
$ nvm install $NODEJS_VERSION --no-progress
Downloading and installing node v10.15.3...
Downloading https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz...
0.0%
0.0%
0.0%
0.0%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.2%
0.2%
0.2%
0.2%
0.2%
0.2%
0.2%
0.2%
0.2%
0.3%
0.3%
0.3%
0.3%
0.3%
0.3%
0.3%
0.3%
0.3%
0.3%
0.4%
0.4%
0.4%
0.4%
0.4%
0.4%
0.4%
0.4%
0.4%
0.5%
0.5%
0.5%
0.6%
0.6%
0.6%
0.7%
0.7%
0.7%
0.8%
0.8%
0.8%
0.9%
0.9%
0.9%
1.0%
1.0%
1.0%
1.1%
1.1%
1.1%
1.2%
1.2%
1.2%
1.3%
1.3%
1.3%
1.4%
# 1.4%
# 1.4%
# 1.5%
# 1.5%
# 1.5%
# 1.6%
# 1.6%
# 1.6%
# 1.7%
# 1.7%
# 1.7%
# 1.8%
# 1.9%
# 2.0%
# 2.1%
# 2.3%
# 2.4%
# 2.5%
# 2.7%
## 2.8%
## 2.9%
## 3.1%
## 3.2%
## 3.3%
## 3.5%
## 3.6%
## 3.7%
## 3.9%
## 4.0%
## 4.1%
### 4.3%
### 4.4%
### 4.5%
### 4.7%
### 4.8%
### 4.9%
### 5.1%
### 5.2%
### 5.3%
### 5.5%
#### 5.6%
#### 5.7%
#### 5.9%
#### 6.0%
#### 6.1%
#### 6.3%
#### 6.4%
#### 6.5%
#### 6.7%
#### 6.8%
#### 6.9%
##### 7.1%
##### 7.2%
##### 7.3%
##### 7.5%
##### 7.6%
##### 7.7%
##### 7.9%
##### 8.0%
##### 8.1%
##### 8.3%
###### 8.4%
###### 8.5%
###### 8.6%
###### 8.8%
###### 8.9%
###### 9.0%
###### 9.2%
###### 9.3%
###### 9.4%
###### 9.6%
###### 9.7%
####### 9.8%
####### 10.0%
####### 10.1%
####### 10.2%
####### 10.4%
####### 10.5%
####### 10.6%
####### 10.8%
####### 10.9%
####### 11.0%
######## 11.2%
######## 11.3%
######## 11.4%
######## 11.6%
######## 11.7%
######## 11.8%
######## 12.0%
######## 12.1%
######## 12.2%
######## 12.4%
######### 12.5%
######### 12.6%
######### 12.8%
######### 12.9%
######### 13.0%
######### 13.2%
######### 13.3%
######### 13.4%
######### 13.6%
######### 13.7%
######### 13.8%
########## 14.0%
########## 14.1%
########## 14.2%
########## 14.4%
########## 14.5%
########## 14.6%
########## 14.8%
########## 14.9%
########## 15.0%
########## 15.2%
########### 15.3%
########### 15.4%
########### 15.6%
########### 15.7%
########### 15.8%
########### 16.0%
########### 16.1%
########### 16.2%
########### 16.4%
########### 16.5%
########### 16.6%
############ 16.8%
############ 16.9%
############ 17.0%
############ 17.2%
############ 17.3%
############ 17.4%
############ 17.6%
############ 17.7%
############ 17.8%
############ 18.0%
############# 18.1%
############# 18.2%
############# 18.4%
############# 18.5%
############# 18.6%
############# 18.8%
############# 18.9%
############# 19.0%
############# 19.2%
############# 19.3%
############# 19.4%
############## 19.6%
############## 19.7%
############## 19.8%
############## 20.0%
############## 20.1%
############## 20.2%
############## 20.4%
############## 20.5%
############## 20.6%
############## 20.8%
############### 20.9%
############### 21.0%
############### 21.2%
############### 21.3%
############### 21.4%
############### 21.6%
############### 21.7%
############### 21.8%
############### 22.0%
############### 22.1%
################ 22.2%
################ 22.4%
################ 22.5%
################ 22.6%
################ 22.8%
################ 22.9%
################ 23.0%
################ 23.2%
################ 23.3%
################ 23.4%
################ 23.6%
################# 23.7%
################# 23.8%
################# 24.0%
################# 24.1%
################# 24.2%
################# 24.4%
################# 24.5%
################# 24.6%
################# 24.8%
################# 24.9%
################## 25.0%
################## 25.2%
################## 25.3%
################## 25.4%
################## 25.6%
################## 25.7%
################## 25.8%
################## 26.0%
################## 26.1%
################## 26.2%
################## 26.4%
################### 26.5%
################### 26.6%
################### 26.8%
################### 26.9%
################### 27.0%
################### 27.2%
################### 27.3%
################### 27.4%
################### 27.6%
################### 27.7%
#################### 27.8%
#################### 27.9%
#################### 28.1%
#################### 28.2%
#################### 28.3%
#################### 28.5%
#################### 28.6%
#################### 28.7%
#################### 28.9%
#################### 29.0%
#################### 29.1%
##################### 29.3%
##################### 29.4%
##################### 29.5%
##################### 29.7%
##################### 29.8%
##################### 29.9%
##################### 30.1%
##################### 30.2%
##################### 30.3%
##################### 30.5%
###################### 30.6%
###################### 30.7%
###################### 30.9%
###################### 31.0%
###################### 31.1%
###################### 31.3%
###################### 31.4%
###################### 31.5%
###################### 31.7%
###################### 31.8%
###################### 31.9%
####################### 32.1%
####################### 32.2%
####################### 32.3%
####################### 32.5%
####################### 32.6%
####################### 32.7%
####################### 32.9%
####################### 33.0%
####################### 33.1%
####################### 33.3%
######################## 33.4%
######################## 33.5%
######################## 33.7%
######################## 33.8%
######################## 33.9%
######################## 34.1%
######################## 34.2%
######################## 34.3%
######################## 34.5%
######################## 34.6%
######################### 34.7%
######################### 34.9%
######################### 35.0%
######################### 35.1%
######################### 35.3%
######################### 35.4%
######################### 35.5%
######################### 35.7%
######################### 35.8%
######################### 35.9%
######################### 36.1%
########################## 36.2%
########################## 36.3%
########################## 36.5%
########################## 36.6%
########################## 36.7%
########################## 36.9%
########################## 37.0%
########################## 37.1%
########################## 37.3%
########################## 37.4%
########################### 37.5%
########################### 37.7%
########################### 37.8%
########################### 37.9%
########################### 38.1%
########################### 38.2%
########################### 38.3%
########################### 38.5%
########################### 38.6%
########################### 38.7%
########################### 38.9%
############################ 39.0%
############################ 39.1%
############################ 39.3%
############################ 39.4%
############################ 39.5%
############################ 39.7%
############################ 39.8%
############################ 39.9%
############################ 40.1%
############################ 40.2%
############################# 40.3%
############################# 40.5%
############################# 40.6%
############################# 40.7%
############################# 40.9%
############################# 41.0%
############################# 41.1%
############################# 41.3%
############################# 41.4%
############################# 41.5%
############################# 41.7%
############################## 41.8%
############################## 41.9%
############################## 42.1%
############################## 42.2%
############################## 42.3%
############################## 42.5%
############################## 42.6%
############################## 42.7%
############################## 42.9%
############################## 43.0%
############################### 43.1%
############################### 43.3%
############################### 43.4%
############################### 43.5%
############################### 43.7%
############################### 43.8%
############################### 43.9%
############################### 44.1%
############################### 44.2%
############################### 44.3%
################################ 44.5%
################################ 44.6%
################################ 44.7%
################################ 44.9%
################################ 45.0%
################################ 45.1%
################################ 45.3%
################################ 45.4%
################################ 45.5%
################################ 45.7%
################################ 45.8%
################################# 45.9%
################################# 46.1%
################################# 46.2%
################################# 46.3%
################################# 46.5%
################################# 46.6%
################################# 46.7%
################################# 46.9%
################################# 47.0%
################################# 47.1%
################################## 47.2%
################################## 47.4%
################################## 47.5%
################################## 47.6%
################################## 47.8%
################################## 47.9%
################################## 48.0%
################################## 48.2%
################################## 48.3%
################################## 48.4%
################################## 48.6%
################################### 48.7%
################################### 48.8%
################################### 49.0%
################################### 49.1%
################################### 49.2%
################################### 49.4%
################################### 49.5%
################################### 49.6%
################################### 49.8%
################################### 49.9%
#################################### 50.0%
#################################### 50.2%
#################################### 50.3%
#################################### 50.4%
#################################### 50.6%
#################################### 50.7%
#################################### 50.8%
#################################### 51.0%
#################################### 51.1%
#################################### 51.2%
#################################### 51.4%
##################################### 51.5%
##################################### 51.6%
##################################### 51.8%
##################################### 51.9%
##################################### 52.0%
##################################### 52.2%
##################################### 52.3%
##################################### 52.4%
##################################### 52.6%
##################################### 52.7%
###################################### 52.8%
###################################### 53.0%
###################################### 53.1%
###################################### 53.2%
###################################### 53.4%
###################################### 53.5%
###################################### 53.6%
###################################### 53.8%
###################################### 53.9%
###################################### 54.0%
####################################### 54.2%
####################################### 54.3%
####################################### 54.4%
####################################### 54.6%
####################################### 54.7%
####################################### 54.8%
####################################### 55.0%
####################################### 55.1%
####################################### 55.2%
####################################### 55.4%
####################################### 55.5%
######################################## 55.6%
######################################## 55.8%
######################################## 55.9%
######################################## 56.0%
######################################## 56.2%
######################################## 56.3%
######################################## 56.4%
######################################## 56.6%
######################################## 56.7%
######################################## 56.8%
######################################### 57.0%
######################################### 57.1%
######################################### 57.2%
######################################### 57.4%
######################################### 57.5%
######################################### 57.6%
######################################### 57.8%
######################################### 57.9%
######################################### 58.0%
######################################### 58.2%
######################################### 58.3%
########################################## 58.4%
########################################## 58.6%
########################################## 58.7%
########################################## 58.8%
########################################## 59.0%
########################################## 59.1%
########################################## 59.2%
########################################## 59.4%
########################################## 59.5%
########################################## 59.6%
########################################### 59.8%
########################################### 59.9%
########################################### 60.0%
########################################### 60.2%
########################################### 60.3%
########################################### 60.4%
########################################### 60.6%
########################################### 60.7%
########################################### 60.8%
########################################### 61.0%
########################################### 61.1%
############################################ 61.2%
############################################ 61.4%
############################################ 61.5%
############################################ 61.6%
############################################ 61.8%
############################################ 61.9%
############################################ 62.0%
############################################ 62.2%
############################################ 62.3%
############################################ 62.4%
############################################# 62.6%
############################################# 62.7%
############################################# 62.8%
############################################# 63.0%
############################################# 63.1%
############################################# 63.2%
############################################# 63.4%
############################################# 63.5%
############################################# 63.6%
############################################# 63.8%
############################################# 63.9%
############################################## 64.0%
############################################## 64.2%
############################################## 64.3%
############################################## 64.4%
############################################## 64.6%
############################################## 64.7%
############################################## 64.8%
############################################## 65.0%
############################################## 65.1%
############################################## 65.2%
############################################### 65.4%
############################################### 65.5%
############################################### 65.6%
############################################### 65.8%
############################################### 65.9%
############################################### 66.0%
############################################### 66.2%
############################################### 66.3%
############################################### 66.4%
############################################### 66.5%
################################################ 66.7%
################################################ 66.8%
################################################ 66.9%
################################################ 67.1%
################################################ 67.2%
################################################ 67.3%
################################################ 67.5%
################################################ 67.6%
################################################ 67.7%
################################################ 67.9%
################################################ 68.0%
################################################# 68.1%
################################################# 68.3%
################################################# 68.4%
################################################# 68.5%
################################################# 68.7%
################################################# 68.8%
################################################# 68.9%
################################################# 69.1%
################################################# 69.2%
################################################# 69.3%
################################################## 69.5%
################################################## 69.6%
################################################## 69.7%
################################################## 69.9%
################################################## 70.0%
################################################## 70.1%
################################################## 70.3%
################################################## 70.4%
################################################## 70.5%
################################################## 70.7%
################################################## 70.8%
################################################### 70.9%
################################################### 71.1%
################################################### 71.2%
################################################### 71.3%
################################################### 71.5%
################################################### 71.6%
################################################### 71.7%
################################################### 71.9%
################################################### 72.0%
################################################### 72.1%
#################################################### 72.3%
#################################################### 72.4%
#################################################### 72.5%
#################################################### 72.7%
#################################################### 72.8%
#################################################### 72.9%
#################################################### 73.1%
#################################################### 73.2%
#################################################### 73.3%
#################################################### 73.5%
#################################################### 73.6%
##################################################### 73.7%
##################################################### 73.9%
##################################################### 74.0%
##################################################### 74.1%
##################################################### 74.3%
##################################################### 74.4%
##################################################### 74.5%
##################################################### 74.7%
##################################################### 74.8%
##################################################### 74.9%
###################################################### 75.1%
###################################################### 75.2%
###################################################### 75.3%
###################################################### 75.5%
###################################################### 75.6%
###################################################### 75.7%
###################################################### 75.9%
###################################################### 76.0%
###################################################### 76.1%
###################################################### 76.3%
####################################################### 76.4%
####################################################### 76.5%
####################################################### 76.7%
####################################################### 76.8%
####################################################### 76.9%
####################################################### 77.1%
####################################################### 77.2%
####################################################### 77.3%
####################################################### 77.5%
####################################################### 77.6%
####################################################### 77.7%
######################################################## 77.9%
######################################################## 78.0%
######################################################## 78.1%
######################################################## 78.3%
######################################################## 78.4%
######################################################## 78.5%
######################################################## 78.7%
######################################################## 78.8%
######################################################## 78.9%
######################################################## 79.1%
######################################################### 79.2%
######################################################### 79.3%
######################################################### 79.5%
######################################################### 79.6%
######################################################### 79.7%
######################################################### 79.9%
######################################################### 80.0%
######################################################### 80.1%
######################################################### 80.3%
######################################################### 80.4%
######################################################### 80.5%
########################################################## 80.7%
########################################################## 80.8%
########################################################## 80.9%
########################################################## 81.1%
########################################################## 81.2%
########################################################## 81.3%
########################################################## 81.5%
########################################################## 81.6%
########################################################## 81.7%
########################################################## 81.9%
########################################################### 82.0%
########################################################### 82.1%
########################################################### 82.3%
########################################################### 82.4%
########################################################### 82.5%
########################################################### 82.7%
########################################################### 82.8%
########################################################### 82.9%
########################################################### 83.1%
########################################################### 83.2%
########################################################### 83.3%
############################################################ 83.5%
############################################################ 83.6%
############################################################ 83.7%
############################################################ 83.9%
############################################################ 84.0%
############################################################ 84.1%
############################################################ 84.3%
############################################################ 84.4%
############################################################ 84.5%
############################################################ 84.7%
############################################################# 84.8%
############################################################# 84.9%
############################################################# 85.1%
############################################################# 85.2%
############################################################# 85.3%
############################################################# 85.5%
############################################################# 85.6%
############################################################# 85.7%
############################################################# 85.8%
############################################################# 86.0%
############################################################## 86.1%
############################################################## 86.2%
############################################################## 86.4%
############################################################## 86.5%
############################################################## 86.6%
############################################################## 86.8%
############################################################## 86.9%
############################################################## 87.0%
############################################################## 87.2%
############################################################## 87.3%
############################################################## 87.4%
############################################################### 87.6%
############################################################### 87.7%
############################################################### 87.8%
############################################################### 88.0%
############################################################### 88.1%
############################################################### 88.2%
############################################################### 88.4%
############################################################### 88.5%
############################################################### 88.6%
############################################################### 88.8%
################################################################ 88.9%
################################################################ 89.0%
################################################################ 89.2%
################################################################ 89.3%
################################################################ 89.4%
################################################################ 89.6%
################################################################ 89.7%
################################################################ 89.8%
################################################################ 90.0%
################################################################ 90.1%
################################################################ 90.2%
################################################################# 90.4%
################################################################# 90.5%
################################################################# 90.6%
################################################################# 90.8%
################################################################# 90.9%
################################################################# 91.0%
################################################################# 91.2%
################################################################# 91.3%
################################################################# 91.4%
################################################################# 91.6%
################################################################## 91.7%
################################################################## 91.8%
################################################################## 92.0%
################################################################## 92.1%
################################################################## 92.2%
################################################################## 92.4%
################################################################## 92.5%
################################################################## 92.6%
################################################################## 92.8%
################################################################## 92.9%
################################################################## 93.0%
################################################################### 93.2%
################################################################### 93.3%
################################################################### 93.4%
################################################################### 93.6%
################################################################### 93.7%
################################################################### 93.8%
################################################################### 94.0%
################################################################### 94.1%
################################################################### 94.2%
################################################################### 94.4%
#################################################################### 94.5%
#################################################################### 94.6%
#################################################################### 94.8%
#################################################################### 94.9%
#################################################################### 95.0%
#################################################################### 95.2%
#################################################################### 95.3%
#################################################################### 95.4%
#################################################################### 95.6%
#################################################################### 95.7%
#################################################################### 95.8%
##################################################################### 96.0%
##################################################################### 96.1%
##################################################################### 96.2%
##################################################################### 96.4%
##################################################################### 96.5%
##################################################################### 96.6%
##################################################################### 96.8%
##################################################################### 96.9%
##################################################################### 97.0%
##################################################################### 97.2%
###################################################################### 97.3%
###################################################################### 97.4%
###################################################################### 97.6%
###################################################################### 97.7%
###################################################################### 97.8%
###################################################################### 98.0%
###################################################################### 98.1%
###################################################################### 98.2%
###################################################################### 98.4%
###################################################################### 98.5%
####################################################################### 98.6%
####################################################################### 98.8%
####################################################################### 98.9%
####################################################################### 99.0%
####################################################################### 99.2%
####################################################################### 99.3%
####################################################################### 99.4%
####################################################################### 99.6%
####################################################################### 99.7%
####################################################################### 99.8%
####################################################################### 100.0%
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
@tsm91 the flag has to go before the version, or else nvm thinks it’s an additional installation compilation flag.
@ljharb you are right, thanks :)
It should be automatically enabled when CI environment variable is set
Any behavior that magically kicks in when it thinks it's in CI is confusing, hard to debug, and hard to maintain, so i'm skeptical about that.
This is how other tools work. Both yarn and npm adjust behavior based on this variable.
I'm aware; that doesn't mean it's a good idea.
tbh it seems like the better option is for jenkins to support console lines that update in-place in its streaming log.
I have decided to create a generic solution for myself that applies to any utility and any CI.
https://github.com/samrocketman/home/blob/main/bin/reduced-log-run.sh
Here's some example usage
reduced-log-run.sh -- nvm install thing