Commit 8b1d738e authored by tony@chromium.org's avatar tony@chromium.org

2010-12-10 Tony Chang <tony@chromium.org>

        Reviewed by Eric Seidel.

        Use FileSystem::remove when cleaning up http lock files
        https://bugs.webkit.org/show_bug.cgi?id=50830

        * Scripts/webkitpy/layout_tests/port/http_lock.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b4be94a9
2010-12-10 Tony Chang <tony@chromium.org>
Reviewed by Eric Seidel.
Use FileSystem::remove when cleaning up http lock files
https://bugs.webkit.org/show_bug.cgi?id=50830
* Scripts/webkitpy/layout_tests/port/http_lock.py:
2010-12-10 Joone Hur <joone@kldp.org>
Reviewed by Martin Robinson.
......
......@@ -103,12 +103,10 @@ class FileSystem(object):
pass
def remove(self, path, osremove=os.remove):
"""On Windows, os.remove can sometimes fail. We see this behavior in
Chromium tests as well and are unsure why. Others on the internet are
equally confused:
http://social.msdn.microsoft.com/Forums/en/windowssearch/thread/55582d9d-77ea-47d9-91ce-cff7ca7ef528
http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/base/test/test_file_util_win.cc&q=diefiledie&exact_package=chromium&l=22
"""
"""On Windows, if a process was recently killed and it held on to a
file, the OS will hold on to the file for a short while. This makes
attempts to delete the file fail. To work around that, this method
will retry for a few seconds until Windows is done with the file."""
try:
exceptions.WindowsError
except AttributeError:
......
......@@ -37,6 +37,7 @@ import time
from webkitpy.common.system.executive import Executive
from webkitpy.common.system.file_lock import FileLock
from webkitpy.common.system.filesystem import FileSystem
_log = logging.getLogger("webkitpy.layout_tests.port.http_lock")
......@@ -61,7 +62,7 @@ class HttpLock(object):
"""Delete the lock file if exists."""
if os.path.exists(self._process_lock_file_name):
_log.debug("Removing lock file: %s" % self._process_lock_file_name)
os.unlink(self._process_lock_file_name)
FileSystem().remove(self._process_lock_file_name)
def _extract_lock_number(self, lock_file_name):
"""Return the lock number from lock file."""
......@@ -93,7 +94,7 @@ class HttpLock(object):
current_lock_file.close()
if not (current_pid and self._executive.check_running_pid(int(current_pid))):
_log.debug("Removing stuck lock file: %s" % lock_list[0])
os.unlink(lock_list[0])
FileSystem().remove(lock_list[0])
return
except (IOError, OSError):
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment