summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2015-07-13 12:20:04 +0000
committerintrigeri <intrigeri@boum.org>2015-07-13 12:40:44 +0000
commit78eaec8c0d85a2535f372512e2a47e39d5e1db7d (patch)
treeed84a8e597ff7ce1ec0d2bb4638ad2846a5b2f3f
parent648c5c886feb593ae256c73477e54ca6ddea7ce5 (diff)
Delete the log file on exit, if it's empty.bugfix/9349-safer-error-logging
Refs: #9349
-rwxr-xr-xliveusb/creator.py7
-rwxr-xr-xliveusb/gui.py2
2 files changed, 8 insertions, 1 deletions
diff --git a/liveusb/creator.py b/liveusb/creator.py
index 8b7cf23..a6ad5a8 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -1025,6 +1025,13 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
self.log.debug("Killed process %d" % pid)
except OSError, e:
self.log.debug(str(e))
+ if os.path.exists(self._error_log_filename):
+ if not os.path.getsize(self._error_log_filename):
+ # We don't want any failure here to block other tear down tasks
+ try:
+ os.unlink(self._error_log_filename)
+ except:
+ print >> sys.stderr, "Could not delete log file."
def get_proxies(self):
""" Return the proxy settings.
diff --git a/liveusb/gui.py b/liveusb/gui.py
index 6ac7ce0..31f0389 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -779,5 +779,5 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
self._refresh_overlay_slider()
def terminate(self):
- """ Terminate any processes that we have spawned """
+ """ Final clean up """
self.live.terminate()