diff hgext/inotify/server.py @ 18096:cd53e40ab0e2

inotify: don't fall over just because of a dangling symlink Previously, the inotify server failed to start if .hg/inotify.sock was a symlink that pointed to a non-existent path. This behaviour does not seem to make any sense. Now, if we encounter a broken symlink, we unlink it and continue.
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 18 Dec 2012 17:33:32 -0800
parents cfb6682961b8
children ae54cff742e2
line wrap: on
line diff
--- a/hgext/inotify/server.py	Wed Dec 19 10:40:34 2012 -0800
+++ b/hgext/inotify/server.py	Tue Dec 18 17:33:32 2012 -0800
@@ -338,8 +338,7 @@
             if os.path.exists(self.sockpath):
                 self.realsockpath = os.readlink(self.sockpath)
             else:
-                raise util.Abort('inotify-server: cannot start: '
-                                '.hg/inotify.sock is a broken symlink')
+                os.unlink(self.sockpath)
         try:
             self.sock.bind(self.realsockpath)
         except socket.error, err: