X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=git-p4.py;h=5b79920f46a972437ff05966d042a84d44f050d9;hb=HEAD;hp=28ab12c72b6561bf6f583391acf8daa300a6211b;hpb=2b5738c867c1fb085a33544640bb9c52372ae2f7;p=thirdparty%2Fgit.git diff --git a/git-p4.py b/git-p4.py index 28ab12c72b..f1ab31d540 100755 --- a/git-p4.py +++ b/git-p4.py @@ -3253,17 +3253,19 @@ class P4Sync(Command, P4UserMap): if self.stream_have_file_info: if "depotFile" in self.stream_file: f = self.stream_file["depotFile"] - # force a failure in fast-import, else an empty - # commit will be made - self.gitStream.write("\n") - self.gitStream.write("die-now\n") - self.gitStream.close() - # ignore errors, but make sure it exits first - self.importProcess.wait() - if f: - die("Error from p4 print for %s: %s" % (f, err)) - else: - die("Error from p4 print: %s" % err) + try: + # force a failure in fast-import, else an empty + # commit will be made + self.gitStream.write("\n") + self.gitStream.write("die-now\n") + self.gitStream.close() + # ignore errors, but make sure it exits first + self.importProcess.wait() + finally: + if f: + die("Error from p4 print for %s: %s" % (f, err)) + else: + die("Error from p4 print: %s" % err) if 'depotFile' in marshalled and self.stream_have_file_info: # start of a new file - output the old one first