hgext/inotify/server.py
changeset 11567 34cc8b84407f
parent 11545 db9d16233787
child 11943 2d3cbcace897
equal deleted inserted replaced
11566:4d11fde55cc5 11567:34cc8b84407f
   334         self.sockpath = join(root, '.hg/inotify.sock')
   334         self.sockpath = join(root, '.hg/inotify.sock')
   335         self.realsockpath = None
   335         self.realsockpath = None
   336         try:
   336         try:
   337             self.sock.bind(self.sockpath)
   337             self.sock.bind(self.sockpath)
   338         except socket.error, err:
   338         except socket.error, err:
   339             if err[0] == errno.EADDRINUSE:
   339             if err.args[0] == errno.EADDRINUSE:
   340                 raise AlreadyStartedException(_('cannot start: socket is '
   340                 raise AlreadyStartedException(_('cannot start: socket is '
   341                                                 'already bound'))
   341                                                 'already bound'))
   342             if err[0] == "AF_UNIX path too long":
   342             if err.args[0] == "AF_UNIX path too long":
   343                 if os.path.islink(self.sockpath) and \
   343                 if os.path.islink(self.sockpath) and \
   344                         not os.path.exists(self.sockpath):
   344                         not os.path.exists(self.sockpath):
   345                     raise util.Abort('inotify-server: cannot start: '
   345                     raise util.Abort('inotify-server: cannot start: '
   346                                     '.hg/inotify.sock is a broken symlink')
   346                                     '.hg/inotify.sock is a broken symlink')
   347                 tempdir = tempfile.mkdtemp(prefix="hg-inotify-")
   347                 tempdir = tempfile.mkdtemp(prefix="hg-inotify-")
   435                                             *map(len, results)))
   435                                             *map(len, results)))
   436                 sock.sendall(''.join(results))
   436                 sock.sendall(''.join(results))
   437             finally:
   437             finally:
   438                 sock.shutdown(socket.SHUT_WR)
   438                 sock.shutdown(socket.SHUT_WR)
   439         except socket.error, err:
   439         except socket.error, err:
   440             if err[0] != errno.EPIPE:
   440             if err.args[0] != errno.EPIPE:
   441                 raise
   441                 raise
   442 
   442 
   443 if sys.platform == 'linux2':
   443 if sys.platform == 'linux2':
   444     import linuxserver as _server
   444     import linuxserver as _server
   445 else:
   445 else: