Provides debuging option for TCP stream

The TCP BaseClient class has been modified to recognize an environment
variable 'PYMODES_DEBUG'. When the variable is set to 'true', the
stream will halt execution rather than restarting. This is for
debugging purposes and does not alter the main functionality of
the program.
This commit is contained in:
Alexander Hirsch 2019-06-03 16:08:28 -07:00
parent 6159691c3d
commit 312c77629b

View File

@ -269,7 +269,16 @@ class BaseClient(Thread):
time.sleep(0.001)
except Exception as e:
print("Unexpected Error:", e)
# Provides the user an option to supply the environment
# variable PYMODES_DEBUG to halt the execution
# for debugging purposes
debug_intent = os.environ.get('PYMODES_DEBUG', None)
if debug_intent.lower() == 'true':
sys.exc_info()
sys.exit()
else:
print("Unexpected Error:", e)
try:
sock = self.connect()