From: Luke Diamand Date: Wed, 29 Jan 2020 11:12:41 +0000 (+0000) Subject: git-p4: make closeStreams() idempotent X-Git-Tag: v2.26.0-rc0~57^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=837b3a6376804ec70b88f06c3f702a38c59196c3;p=thirdparty%2Fgit.git git-p4: make closeStreams() idempotent Ensure that we can safely call self.closeStreams() multiple times, and can also call it even if there is no git fast-import stream at all. Signed-off-by: Luke Diamand Signed-off-by: Junio C Hamano --- diff --git a/git-p4.py b/git-p4.py index 40d9e7c594..23724defe8 100755 --- a/git-p4.py +++ b/git-p4.py @@ -3549,11 +3549,14 @@ class P4Sync(Command, P4UserMap): self.gitError = self.importProcess.stderr def closeStreams(self): + if self.gitStream is None: + return self.gitStream.close() if self.importProcess.wait() != 0: die("fast-import failed: %s" % self.gitError.read()) self.gitOutput.close() self.gitError.close() + self.gitStream = None def run(self, args): if self.importIntoRemotes: