Just realized Windows is a supported OS. This should be more portable.

This commit is contained in:
Mason Donahue 2014-08-24 01:19:10 -05:00
parent 91d0bb4fda
commit 0e5b182a54

View File

@ -306,8 +306,9 @@ def tails_root():
def register_cleanup_handler(directory): def register_cleanup_handler(directory):
import signal import signal
import shutil
def handler(signum = None, frame = None): def handler(signum = None, frame = None):
subprocess.call(['rm','-r',directory]) shutil.rmtree(directory)
sys.exit() sys.exit()
for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]: for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]:
signal.signal(sig, handler) signal.signal(sig, handler)