obihann/archey-osx

1.5 IP timeout & Battery

Closed this issue ยท 12 comments

Thanks for a really great utility! ๐Ÿ‘ I wanted to report 2 issues with 1.5:

% archey -c

                 ###                  User: jh
               ####                   Hostname: jhmp
               ###                    Distro: OS X 10.11.1
       #######    #######             Kernel: Darwin
     ######################           Uptime: 16:44  up 8 days,  3:36, 4 users, load averages: 1.64 1.53 1.58
    #####################             Shell: /usr/local/bin/zsh
    ####################              Terminal: xterm-256color iTerm.app
    ####################              Packages: 7
    #####################             CPU: Intel Xeon CPU E5-1680 v2 @ 3.00GHz
     ######################           Memory: 32 GB
      ####################            Disk: 36%
        ################              Battery:
         ####     #####               IP Address: ;; connection timed out; no servers could be reached

๐Ÿ”‹๐Ÿšซ I'm on a Mac Pro, which doesn't have a battery, so it seems peculiar to include a blank battery line here.

โŒ› archey now takes about 10 seconds to execute because the IP fetch times out. I've verified that the underlying command archey is using (dig +short myip.opendns.com @resolver1.opendns.com) is the cause of this delay, and that command still times out and prints the above message when used alone. It may be that my current network is blocking or filtering opendns, but even if not, this network request is still likely to be the slowest part about running archey. Perhaps it's worth adding an optional switch to disable the IP address fetch?

Thanks for noticing this, I'll look into both and try to get them taken care of before 1.5.x is released into homebrew.

@jhersh Could you do me a favour and verify that 5194561 hides the battery field for you without causing any new issues? I don't have a machine without a battery so I can only make an assumption this will work. Thanks!

edit: changed to a different commit

@obihann Thanks for checking into this! Unfortunately it's still there:

[0] % git rev-parse HEAD
fa463d4c9d3b213cb9b55c231c6eb3d090c278a6

[0] % gb
* master

[0] % bin/archey -o

                 ###                  User: jh
               ####                   Hostname: jhmp
               ###                    Distro: OS X 10.11.1
       #######    #######             Kernel: Darwin
     ######################           Uptime: 8 days
    #####################             Shell: /usr/local/bin/zsh
    ####################              Terminal: xterm-256color iTerm.app
    ####################              Packages: 7
    #####################             CPU: Intel Xeon CPU E5-1680 v2 @ 3.00GHz
     ######################           Memory: 32 GB
      ####################            Disk: 44%
        ################              Battery:
         ####     #####

One other minor thing I noticed:

[0] % bin/archey -co
Unknown argument: -co
For help, use: bin/archey --help

Looks like it wants archey -c -o instead.

๐Ÿ‘Ž thats too bad. Could you run ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}' and paste me the output? Then I should know exactly what users see when they have no battery, and I can filter it from there. Thanks.

No output ("capacity" does not appear anywhere in ioreg -l)

I think I see it now! I should have this fixed shortly.

6050fbc should fix this, let me know if not ๐Ÿ‘

๐Ÿ‘๐Ÿ†’๐Ÿ’ฏ

Sweet! Thanks.

thanks for resolving the battery issue, any news on the IP fetching? I have the exact problem when using the corporate wireless network. Thx

@nilstgmd I added two features that are now in master and 1.5.1 PR, one is the addition of a -o flag that disables the IP check, the other is caching of the IP. Basically we store your IP in ~/.archey-ip and next time we load if that file is less than 6 hours old we just read it instead of checking again.

@obihann Great ๐Ÿ‘๐Ÿฟ Thanks for fixing this :shipit: