Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable curl-like download progress #1079

Open
samrocketman opened this issue May 2, 2016 · 21 comments
Open

Option to disable curl-like download progress #1079

samrocketman opened this issue May 2, 2016 · 21 comments
Labels
feature requests I want a new feature in nvm! installing node Issues with installing node/io.js versions. pull request wanted This is a great way to contribute! Help us out :-D

Comments

@samrocketman
Copy link

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.

@ljharb
Copy link
Member

ljharb commented May 3, 2016

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.

@ljharb ljharb added installing node Issues with installing node/io.js versions. feature requests I want a new feature in nvm! pull request wanted This is a great way to contribute! Help us out :-D labels May 3, 2016
@samrocketman
Copy link
Author

Yay, I may come up with a PR this week :)

@samrocketman
Copy link
Author

samrocketman commented May 3, 2016

The following seems roughly equivalent for --no-progress options.

curl -sS
wget -nv

@ljharb
Copy link
Member

ljharb commented May 3, 2016

If it's as widely supported, I'd prefer to use the double-dashed (longer, more verbose) argument names, but 👍

@samrocketman
Copy link
Author

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).

@PeterDaveHello
Copy link
Collaborator

@samrocketman would you like to help test/review #1422?

@samrocketman
Copy link
Author

samrocketman commented Mar 11, 2017

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

PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Mar 17, 2017
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Mar 18, 2017
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Mar 18, 2017
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Mar 19, 2017
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Mar 20, 2017
@tad-lispy
Copy link

tad-lispy commented Jun 7, 2017

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.

@ljharb
Copy link
Member

ljharb commented Jun 7, 2017

@lzrski totally separate from #1079; i think automatically silencing the progress when it's not a TTY makes sense.

PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Jun 23, 2017
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Apr 18, 2018
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Apr 23, 2018
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Apr 23, 2018
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Apr 24, 2018
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Apr 24, 2018
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Apr 24, 2018
PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Apr 25, 2018
ljharb pushed a commit to PeterDaveHello/nvm that referenced this issue May 2, 2018
@ljharb
Copy link
Member

ljharb commented May 2, 2018

Reopening; we still need to switch to no-progress when the output isn't connected to a terminal.

@ljharb ljharb reopened this May 2, 2018
@danielmcq
Copy link

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?

@ljharb
Copy link
Member

ljharb commented May 2, 2018

@danielmcq you're misreading; the commit was originally authored a year ago, but it was merged 19 hours ago.

@danielmcq
Copy link

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

byrney added a commit to byrney/OsxSetup that referenced this issue Aug 23, 2018
* Add nvm from homebrew
* Add an inst_nvm command which will call it

This version of nvm 0.3.11 doesn't support a --no-progress
option so it spews onto the screen. An update
[here] does.

[here]: nvm-sh/nvm#1079
@aegyed91

This comment has been minimized.

@ljharb

This comment has been minimized.

@ljharb ljharb closed this as completed Mar 23, 2019
@ljharb ljharb reopened this Mar 23, 2019
@aegyed91

This comment has been minimized.

@mwisnicki
Copy link

It should be automatically enabled when CI environment variable is set

@ljharb
Copy link
Member

ljharb commented Sep 29, 2022

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.

@mwisnicki
Copy link

This is how other tools work. Both yarn and npm adjust behavior based on this variable.

@ljharb
Copy link
Member

ljharb commented Sep 29, 2022

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.

@samrocketman
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requests I want a new feature in nvm! installing node Issues with installing node/io.js versions. pull request wanted This is a great way to contribute! Help us out :-D
Projects
None yet
Development

No branches or pull requests

7 participants