mercurial/commandserver.py
changeset 35652 40da2d7b4871
parent 35461 3a119a423953
child 36835 5bc7ff103081
equal deleted inserted replaced
35651:15cfd343d3a9 35652:40da2d7b4871
   245                 ui.setconfig('ui', 'nontty', 'true', 'commandserver')
   245                 ui.setconfig('ui', 'nontty', 'true', 'commandserver')
   246 
   246 
   247         req = dispatch.request(args[:], copiedui, self.repo, self.cin,
   247         req = dispatch.request(args[:], copiedui, self.repo, self.cin,
   248                                self.cout, self.cerr)
   248                                self.cout, self.cerr)
   249 
   249 
   250         ret = (dispatch.dispatch(req) or 0) & 255 # might return None
   250         try:
   251 
   251             ret = (dispatch.dispatch(req) or 0) & 255 # might return None
   252         # restore old cwd
   252             self.cresult.write(struct.pack('>i', int(ret)))
   253         if '--cwd' in args:
   253         finally:
   254             os.chdir(self.cwd)
   254             # restore old cwd
   255 
   255             if '--cwd' in args:
   256         self.cresult.write(struct.pack('>i', int(ret)))
   256                 os.chdir(self.cwd)
   257 
   257 
   258     def getencoding(self):
   258     def getencoding(self):
   259         """ writes the current encoding to the result channel """
   259         """ writes the current encoding to the result channel """
   260         self.cresult.write(encoding.encoding)
   260         self.cresult.write(encoding.encoding)
   261 
   261