mercurial/utils/procutil.py
changeset 52582 1b9b6b4aa929
parent 52361 07a5a249faf8
child 52640 24ee91ba9aa8
--- a/mercurial/utils/procutil.py	Tue Dec 17 01:39:33 2024 -0500
+++ b/mercurial/utils/procutil.py	Tue Dec 17 01:45:29 2024 -0500
@@ -328,9 +328,10 @@
     inname, outname = None, None
     try:
         infd, inname = pycompat.mkstemp(prefix=b'hg-filter-in-')
-        fp = os.fdopen(infd, 'wb')
-        fp.write(s)
-        fp.close()
+
+        with os.fdopen(infd, 'wb') as fp:
+            fp.write(s)
+
         outfd, outname = pycompat.mkstemp(prefix=b'hg-filter-out-')
         os.close(outfd)
         cmd = cmd.replace(b'INFILE', inname)