Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commandserver.py @ 46087:ac9de799d390
commandserver: handle IOError related to flushing of streams
After dispatch, without chg we have handling of flushing of streams and
exception handling related to it. The exception handling part is important
because there can be exceptions when flushing fout or ferr.
One such case is in `test-basic.t` which was failing on python3+chg without this
patch as this handling was missing from chg.
Failure can be seen at
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/128399
Honestly I am not sure which one of `chgserver.py` or `commandserver.py` the
change should go in.
Differential Revision: https://phab.mercurial-scm.org/D9517
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 03 Dec 2020 17:18:49 +0530 |
parents | 89a2afe31e82 |
children | 49b6910217f9 |
comparison
equal
deleted
inserted
replaced
46086:e0866c047e64 | 46087:ac9de799d390 |
---|---|
353 self.cmsg, | 353 self.cmsg, |
354 prereposetups=self._prereposetups, | 354 prereposetups=self._prereposetups, |
355 ) | 355 ) |
356 | 356 |
357 try: | 357 try: |
358 ret = self._dispatchcommand(req) & 255 | 358 err = None |
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 | |
359 # If shutdown-on-interrupt is off, it's important to write the | 370 # If shutdown-on-interrupt is off, it's important to write the |
360 # result code *after* SIGINT handler removed. If the result code | 371 # result code *after* SIGINT handler removed. If the result code |
361 # were lost, the client wouldn't be able to continue processing. | 372 # were lost, the client wouldn't be able to continue processing. |
362 self.cresult.write(struct.pack(b'>i', int(ret))) | 373 self.cresult.write(struct.pack(b'>i', int(ret))) |
363 finally: | 374 finally: |