Use atexit to remove temp basedir.

This hopefully fixes a PermissionError on Windows.
This commit is contained in:
Florian Bruhin 2015-05-17 01:29:47 +02:00
parent f17238d3d4
commit 8ab2772dd9

View File

@ -28,6 +28,7 @@ import json
import time import time
import shutil import shutil
import tempfile import tempfile
import atexit
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon, QCursor, QWindow from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon, QCursor, QWindow
@ -643,7 +644,7 @@ class Quitter:
objreg.get('crash-handler').destroy_crashlogfile() objreg.get('crash-handler').destroy_crashlogfile()
# Delete temp basedir # Delete temp basedir
if self._args.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 # If we don't kill our custom handler here we might get segfaults
log.destroy.debug("Deactiving message handler...") log.destroy.debug("Deactiving message handler...")
qInstallMessageHandler(None) qInstallMessageHandler(None)