From 8ab2772dd9bd1747649fd68b781870d2c70231fe Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 17 May 2015 01:29:47 +0200 Subject: [PATCH] Use atexit to remove temp basedir. This hopefully fixes a PermissionError on Windows. --- qutebrowser/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index cfc84c654..64c277c9f 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -28,6 +28,7 @@ import json import time import shutil import tempfile +import atexit from PyQt5.QtWidgets import QApplication from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon, QCursor, QWindow @@ -643,7 +644,7 @@ class Quitter: objreg.get('crash-handler').destroy_crashlogfile() # Delete temp basedir if self._args.temp_basedir: - shutil.rmtree(self._args.basedir) + atexit.register(shutil.rmtree, self._args.basedir) # If we don't kill our custom handler here we might get segfaults log.destroy.debug("Deactiving message handler...") qInstallMessageHandler(None)