list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Philip McGraw <>
To: "" <>
Subject: [PATCH] git-p4: close temporary file before removing
Date: Tue, 30 Jul 2019 17:37:22 +0000	[thread overview]
Message-ID: <> (raw)

python os.remove() throws exceptions on Windows platform when attempting
to remove file while it is still open.  Need to grab filename while file open,
close file handle, then remove by name.  Apparently other platforms are more
permissive of removing files while busy.
--- | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ b/
index c71a6832e2..6b9d2a8317 100755
--- a/
+++ b/
@@ -1161,12 +1161,14 @@ def exceedsLargeFileThreshold(self, relPath, contents):
                 return False
             contentTempFile = self.generateTempFile(contents)
             compressedContentFile = tempfile.NamedTemporaryFile(prefix='git-p4-large-file', delete=False)
+            compressedContentFileName =
             zf = zipfile.ZipFile(, mode='w')
             zf.write(contentTempFile, compress_type=zipfile.ZIP_DEFLATED)
             compressedContentsSize = zf.infolist()[0].compress_size
-            os.remove(
+            compressedContentFile.close()
+            os.remove(compressedContentFileName)
             if compressedContentsSize > gitConfigInt('git-p4.largeFileCompressedThreshold'):
                 return True
         return False

             reply	other threads:[~2019-07-30 17:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30 17:37 Philip McGraw [this message]
2019-07-31  1:48 ` Andrey
2019-07-31 13:53   ` Philip McGraw
2019-07-31 14:09     ` Andrey
2019-07-31 21:51       ` Philip McGraw
2019-08-01  1:34         ` Andrey
2019-08-01 15:30           ` Philip McGraw
2019-08-02  3:50             ` Andrey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \
    --subject='Re: [PATCH] git-p4: close temporary file before removing' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ \
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
 note: .onion URLs require Tor:

code repositories for project(s) associated with this inbox:

AGPL code for this site: git clone