Mercurial > public > mercurial-scm > hg
comparison mercurial/commandserver.py @ 46101:49b6910217f9
dispatch: move IOError handling and flushing of streams to `dispatch()`
Instead of patching both dispatch code and commandserver code, we directly
handle this in `dispatch.dispatch()`.
Thanks to Yuya who recommended this.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 10 Dec 2020 13:51:56 +0530 |
parents | ac9de799d390 |
children | d4ba4d51f85f |
comparison
equal
deleted
inserted
replaced
46100:a771ffc378a8 | 46101:49b6910217f9 |
---|---|
353 self.cmsg, | 353 self.cmsg, |
354 prereposetups=self._prereposetups, | 354 prereposetups=self._prereposetups, |
355 ) | 355 ) |
356 | 356 |
357 try: | 357 try: |
358 err = None | 358 ret = self._dispatchcommand(req) & 255 |
359 try: | |
360 status = self._dispatchcommand(req) | |
361 except error.StdioError as e: | |
362 status = -1 | |
363 err = e | |
364 | |
365 retval = dispatch.closestdio(req.ui, err) | |
366 if retval: | |
367 status = retval | |
368 | |
369 ret = status & 255 | |
370 # If shutdown-on-interrupt is off, it's important to write the | 359 # If shutdown-on-interrupt is off, it's important to write the |
371 # result code *after* SIGINT handler removed. If the result code | 360 # result code *after* SIGINT handler removed. If the result code |
372 # were lost, the client wouldn't be able to continue processing. | 361 # were lost, the client wouldn't be able to continue processing. |
373 self.cresult.write(struct.pack(b'>i', int(ret))) | 362 self.cresult.write(struct.pack(b'>i', int(ret))) |
374 finally: | 363 finally: |