diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py --- a/mercurial/chgserver.py +++ b/mercurial/chgserver.py @@ -438,14 +438,8 @@ class chgcmdserver(commandserver.server) nullfd = os.open(os.devnull, os.O_WRONLY) ui = self.ui for (ch, fp, fd), (cn, fn, mode) in zip(self._oldios, _iochannels): - newfp = getattr(ui, fn) - # On Python 3, newfp is just a wrapper around fp even if newfp is - # not fp, so deleting newfp is safe. - if newfp is not fp: - newfp.close() - # restore original fd: fp is open again try: - if newfp is fp and 'w' in mode: + if 'w' in mode: # Discard buffered data which couldn't be flushed because # of EPIPE. The data should belong to the current session # and should never persist.