mercurial/chgserver.py
changeset 49244 cd51d4957b28
parent 48951 cf99c4af1079
parent 49240 201222849987
child 49275 c6a3243567b6
--- a/mercurial/chgserver.py	Fri May 27 02:54:20 2022 +0200
+++ b/mercurial/chgserver.py	Thu Jun 02 16:24:06 2022 +0200
@@ -446,6 +446,7 @@
                     os.dup2(nullfd, fp.fileno())
                     fp.flush()
                 os.dup2(fd, fp.fileno())
+                os.close(fd)
             except OSError as err:
                 # According to issue6330, running chg on heavy loaded systems
                 # can lead to EBUSY. [man dup2] indicates that, on Linux,
@@ -458,7 +459,6 @@
                     stringutil.forcebytestr(err),
                     fn,
                 )
-            os.close(fd)
             setattr(self, cn, ch)
             setattr(ui, fn, fp)
         os.close(nullfd)