Created
January 7, 2014 13:27
-
-
Save mkorpela/8299257 to your computer and use it in GitHub Desktop.
Print stack trace during test execution.
Works on POSIX not WINDOWS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mport signal | |
import sys | |
import traceback | |
def debug(sig, frame): | |
""" This is a modified version of the one posted to http://stackoverflow.com/a/133384/308189 | |
This one only writes the traceback to real stdout as robot framework redirects the stdout | |
""" | |
message = "\nSignal recieved : \nTraceback:\n" | |
message += ''.join(traceback.format_stack(frame)) | |
sys.__stdout__.write(message+'\n') | |
signal.signal(signal.SIGUSR1, debug) # Register handler | |
# kill -30 pid TO GET IT TO WORK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment