mercurial/commandserver.py
changeset 28156 75f586a1bf55
parent 28027 14033c5dd261
child 28157 e7c9b59dbbcf
equal deleted inserted replaced
28155:7f430b2ac7fd 28156:75f586a1bf55
   187         # is the other end closed?
   187         # is the other end closed?
   188         if not data:
   188         if not data:
   189             raise EOFError
   189             raise EOFError
   190 
   190 
   191         return data
   191         return data
       
   192 
       
   193     def _readstr(self):
       
   194         """read a string from the channel
       
   195 
       
   196         format:
       
   197         data length (uint32), data
       
   198         """
       
   199         length = struct.unpack('>I', self._read(4))[0]
       
   200         if not length:
       
   201             return ''
       
   202         return self._read(length)
       
   203 
       
   204     def _readlist(self):
       
   205         """read a list of NULL separated strings from the channel"""
       
   206         s = self._readstr()
       
   207         if s:
       
   208             return s.split('\0')
       
   209         else:
       
   210             return []
   192 
   211 
   193     def runcommand(self):
   212     def runcommand(self):
   194         """ reads a list of \0 terminated arguments, executes
   213         """ reads a list of \0 terminated arguments, executes
   195         and writes the return code to the result channel """
   214         and writes the return code to the result channel """
   196         from . import dispatch  # avoid cycle
   215         from . import dispatch  # avoid cycle