mercurial/utils/procutil.py
changeset 52582 1b9b6b4aa929
parent 52361 07a5a249faf8
child 52640 24ee91ba9aa8
equal deleted inserted replaced
52581:cc918741a22a 52582:1b9b6b4aa929
   326     with the strings INFILE and OUTFILE replaced by the real names of
   326     with the strings INFILE and OUTFILE replaced by the real names of
   327     the temporary files generated."""
   327     the temporary files generated."""
   328     inname, outname = None, None
   328     inname, outname = None, None
   329     try:
   329     try:
   330         infd, inname = pycompat.mkstemp(prefix=b'hg-filter-in-')
   330         infd, inname = pycompat.mkstemp(prefix=b'hg-filter-in-')
   331         fp = os.fdopen(infd, 'wb')
   331 
   332         fp.write(s)
   332         with os.fdopen(infd, 'wb') as fp:
   333         fp.close()
   333             fp.write(s)
       
   334 
   334         outfd, outname = pycompat.mkstemp(prefix=b'hg-filter-out-')
   335         outfd, outname = pycompat.mkstemp(prefix=b'hg-filter-out-')
   335         os.close(outfd)
   336         os.close(outfd)
   336         cmd = cmd.replace(b'INFILE', inname)
   337         cmd = cmd.replace(b'INFILE', inname)
   337         cmd = cmd.replace(b'OUTFILE', outname)
   338         cmd = cmd.replace(b'OUTFILE', outname)
   338         code = system(cmd)
   339         code = system(cmd)