From 2a3a81b51f1aee5a2da789d07d14cde61c96e8b7 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 12 Jun 2009 09:10:07 -0700 Subject: [PATCH] Ignore EOFError when reading a truncated pickle file If the pickle config file is 0 bytes in length, we may have crashed (or been aborted) while writing the file out to disk. Instead of crashing with a backtrace, just treat the file as though it wasn't present and load off a `git config` fork. Signed-off-by: Shawn O. Pearce --- git_config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git_config.py b/git_config.py index a2a739a..d33c3b1 100644 --- a/git_config.py +++ b/git_config.py @@ -236,6 +236,9 @@ class GitConfig(object): return cPickle.load(fd) finally: fd.close() + except EOFError: + os.remove(self._pickle) + return None except IOError: os.remove(self._pickle) return None