From 0ffaf5cd6733f83e2213bc085d0096f7d25cb406 Mon Sep 17 00:00:00 2001 From: Mike Eriksson Date: Wed, 19 Oct 2016 18:51:28 +0100 Subject: [PATCH] Fix for issue #26 plus cosmetic fixes. --- torpinger | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/torpinger b/torpinger index 16299d3..e8ab37d 100755 --- a/torpinger +++ b/torpinger @@ -74,7 +74,8 @@ class TorPinger(object): print(resp.read()) resp.close() except OSError as e: - print('Time out',e) + print('Error:', e) + sys.exit(1) def which_socks(self): op = subprocess.check_output('netstat -lnt',shell=True).decode() @@ -96,8 +97,8 @@ class TorPinger(object): time.sleep(self.timeout_one_check) ## If we get away from loop due to timeout, then exit if len(SOCKS) == 0: - print('Sorry dude couldn\'t find any active tor connection in the\ - given time, exitting') + print('Sorry dude - couldn\'t find any active Tor connection in the' + ' given time, exiting.') return ## Else we are good to go and have a list of open tor sockets ## Of which we choose the one with highest priority