##// END OF EJS Templates
chgserver: use _readlist and _readstr...
Jun Wu -
r28158:7cc57a53 default
parent child Browse files
Show More
@@ -283,10 +283,9 b' class chgcmdserver(commandserver.server)'
283 Note that the behavior of --cwd option is bit different from this.
283 Note that the behavior of --cwd option is bit different from this.
284 It does not affect --config parameter.
284 It does not affect --config parameter.
285 """
285 """
286 length = struct.unpack('>I', self._read(4))[0]
286 path = self._readstr()
287 if not length:
287 if not path:
288 return
288 return
289 path = self._read(length)
290 _log('chdir to %r\n' % path)
289 _log('chdir to %r\n' % path)
291 os.chdir(path)
290 os.chdir(path)
292
291
@@ -296,11 +295,7 b' class chgcmdserver(commandserver.server)'
296 If pager isn't enabled, this writes '\0' because channeledoutput
295 If pager isn't enabled, this writes '\0' because channeledoutput
297 does not allow to write empty data.
296 does not allow to write empty data.
298 """
297 """
299 length = struct.unpack('>I', self._read(4))[0]
298 args = self._readlist()
300 if not length:
301 args = []
302 else:
303 args = self._read(length).split('\0')
304 try:
299 try:
305 cmd, _func, args, options, _cmdoptions = dispatch._parse(self.ui,
300 cmd, _func, args, options, _cmdoptions = dispatch._parse(self.ui,
306 args)
301 args)
@@ -323,12 +318,9 b' class chgcmdserver(commandserver.server)'
323
318
324 Note that not all variables can make an effect on the running process.
319 Note that not all variables can make an effect on the running process.
325 """
320 """
326 length = struct.unpack('>I', self._read(4))[0]
321 l = self._readlist()
327 if not length:
328 return
329 s = self._read(length)
330 try:
322 try:
331 newenv = dict(l.split('=', 1) for l in s.split('\0'))
323 newenv = dict(s.split('=', 1) for s in l)
332 except ValueError:
324 except ValueError:
333 raise ValueError('unexpected value in setenv request')
325 raise ValueError('unexpected value in setenv request')
334
326
General Comments 0
You need to be logged in to leave comments. Login now