Rafficer / linux-cli-community

Linux command-line client for ProtonVPN. Written in Python.
https://protonvpn.com
GNU General Public License v3.0
1.31k stars 198 forks source link

[BUG] protonvpn status exception (ping not found) #268

Open gmillerd opened 3 years ago

gmillerd commented 3 years ago

Describe the bug ping is assumed installed, likely only to be encountered in containers. isn't included in ubuntu:rolling, etc.

To Reproduce Steps to reproduce the behavior:

protonvpn s
Traceback (most recent call last):
  File "/usr/local/bin/protonvpn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/cli.py", line 73, in main
    cli()
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/cli.py", line 139, in cli
    connection.status()
  File "/usr/local/lib/python3.8/dist-packages/protonvpn_cli/connection.py", line 385, in status
    ping = subprocess.run(["ping", "-c", "1", dns_server],
  File "/usr/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ping'

Expected behavior

protonvpn s
Status:       Connected
Time:         0:02:56
Server:       US-NY#27
Features:     P2P
Protocol:     UDP
Kill Switch:  Disabled
Country:      United States
City:         New York City
Load:         24%
Received:     59.23 KB
Sent:         5.4 KB

Error Messages/Program Output/Log Messages (~/.pvpn-cli/pvpn-cli.log) If applicable, add error messages or output to help explain your problem.

Desktop (please complete the following information):

Additional context

README.md might include package, or gracefully handle lack of ping

sudo apt -y iputils-ping