[tor-commits] [oonib/master] Fix the "directory not empty" error when removing the tmp tor_datadir.

isis at torproject.org isis at torproject.org
Sat May 4 16:10:28 UTC 2013


commit 0a99413af64562e039ce05a7a264565ecd3aedf4
Author: Isis Lovecruft <isis at torproject.org>
Date:   Sun Apr 21 08:00:03 2013 +0000

    Fix the "directory not empty" error when removing the tmp tor_datadir.
---
 oonib/runner.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/oonib/runner.py b/oonib/runner.py
index 4e783df..c3b57b0 100644
--- a/oonib/runner.py
+++ b/oonib/runner.py
@@ -11,6 +11,8 @@ from __future__ import print_function
 import tempfile
 import os
 
+from shutil import rmtree
+
 from twisted.internet import reactor
 from twisted.application import service, internet, app
 from twisted.python.runtime import platformType
@@ -105,12 +107,9 @@ else:
             self.startReactor(None, self.oldstdout, self.oldstderr)
             self.removePID(self.config['pidfile'])
             if os.path.exists(tempfile.gettempdir()):
-                try:
-                    log.msg("Removing temporary directory: %s"
-                            % tempfile.gettempdir())
-                    os.removedirs(tempfile.gettempdir())
-                except OSError as ose:
-                    log.err(ose)
+                log.msg("Removing temporary directory: %s"
+                        % tempfile.gettempdir())
+                rmtree(tempfile.gettempdir(), onerror=log.err)
 
         def createOrGetApplication(self):
             return oonibackend.application





More information about the tor-commits mailing list