Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

update-bash issues #48193

Closed
bfontaine opened this issue Jan 18, 2016 · 6 comments
Closed

update-bash issues #48193

bfontaine opened this issue Jan 18, 2016 · 6 comments
Labels

Comments

@bfontaine
Copy link
Contributor

As @xu-cheng reported it prints a bunch of error messages if you ^C it:

$ brew update-bash
^Cfatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

fatal: Could not read from remote repository.
...snip...

You also get a bunch of error messages (one per tap I guess) if you’re not connected to the Internet:

$ brew update-bash
ssh: Could not resolve hostname github.com: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
...snip...
fatal: unable to access 'https://github.com/caskroom/homebrew-cask/': Could not resolve host: github.com
ssh: Could not resolve hostname github.com: nodename nor servname provided, or not known
fatal: Could not read from remote repository.
...snip...
@MikeMcQuaid
Copy link
Member

@bfontaine @xu-cheng I'm not sure how best to address either of these; thoughts?

@bfontaine
Copy link
Contributor Author

I’m not sure either right now 😕

@DomT4
Copy link
Member

DomT4 commented Jan 19, 2016

You also get a bunch of error messages (one per tap I guess) if you’re not connected to the Internet:

Could possibly do something super simple like:

ping -c 2 8.8.8.8 &> /dev/null || echo "Update cannot be run offline!"; exit 1

The chance of 8.8.8.8 ever being down is about as close to zero as you can get.

Edit - You couldn't stick an exit 1 there thinking about it, because it always would I believe. You could expand it though to deal with that, such as:

if ! ping -c 2 8.8.8.8 &> /dev/null
then
  echo "Update cannot be run offline!"
  exit 1
fi

Edit to the edit - ping might be the wrong thing to use, it seems to hang if there's no route to the host rather than exiting cleanly. We could use curl though via something like:

curl -I --connect-timeout 2 https://www.debian.org &> /dev/null

@bfontaine
Copy link
Contributor Author

@DomT4 Good idea; we might want to ping/curl github.com instead since that what we’ll use to update. We might also want to use a message more generic like “Cannot connect to {github.com,Internet}”.

@DomT4
Copy link
Member

DomT4 commented Jan 19, 2016

@bfontaine I was thinking about that but Github is consistently twice as slow to respond to a header request as Debian is. We're talking 0.3 and 0.6 seconds where the connection is available, so not huge numbers, so we may not care.

@DomT4
Copy link
Member

DomT4 commented Jan 19, 2016

Filed a PR for review. Easier to discuss real ideas which can be pulled/tested than theoretical ideas, etc.

@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants