online module: Don't fail when offline

If the system is offline, socket.gaierror is raised, the module crashes,
and shows `offline` indefinitely.

Catch that exception, and return False.
This commit is contained in:
Hugo Osvaldo Barrera 2016-10-17 20:05:05 -03:00
parent c287204321
commit aeec2e86f3

View File

@ -373,7 +373,7 @@ class internet:
try: try:
socket.create_connection(cls.address, 1).close() socket.create_connection(cls.address, 1).close()
return True return True
except OSError: except (OSError, socket.gaierror):
return False return False