Skip to content
This repository has been archived by the owner on Jan 22, 2018. It is now read-only.

Fix up temporary file usage for Windows #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -780,10 +780,11 @@ class P4FileReader:

if header['type'].startswith('utf16'):
# Don't even try to convert utf16. Ask p4 to write the file directly.
tmpFile = tempfile.NamedTemporaryFile()
P4Helper().p4_system("print -o \"%s\" \"%s\"" % (tmpFile.name, escapeStringP4(header['depotFile'])))
text = open(tmpFile.name).read()
tmpFile.close()
with tempfile.NamedTemporaryFile(delete=False) as tmpFile:
tmpFileName = tmpFile.name
P4Helper().p4_system("print -o \"%s\" \"%s\"" % (tmpFileName, escapeStringP4(header['depotFile'])))
print "done"
text = open(tmpFileName).read()
else:
text = textBuffer.getvalue()
textBuffer.close()
Expand Down