diff options
author | Joey Hess <joey@kitenet.net> | 2014-01-01 21:42:25 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-01-01 21:42:25 -0400 |
commit | ae3837431df9404dc70e3a73855c25aa71d2b1de (patch) | |
tree | 9184429402aa6328bee3bc110c5985fc496daa42 /Git/Command.hs | |
parent | a69a27588057600f304fff6eeb9cbb42bc9ebb36 (diff) |
Avoid looping if long-running git cat-file or git hash-object crashes and keeps crashing when restarted.
Diffstat (limited to 'Git/Command.hs')
-rw-r--r-- | Git/Command.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Git/Command.hs b/Git/Command.hs index adcc53bcd..4c338ba25 100644 --- a/Git/Command.hs +++ b/Git/Command.hs @@ -128,9 +128,14 @@ leaveZombie = fst {- Runs a git command as a coprocess. -} gitCoProcessStart :: Bool -> [CommandParam] -> Repo -> IO CoProcess.CoProcessHandle -gitCoProcessStart restartable params repo = CoProcess.start restartable "git" +gitCoProcessStart restartable params repo = CoProcess.start numrestarts "git" (toCommand $ gitCommandLine params repo) (gitEnv repo) + where + {- If a long-running git command like cat-file --batch + - crashes, it will likely start up again ok. If it keeps crashing + - 10 times, something is badly wrong. -} + numrestarts = if restartable then 10 else 0 gitCreateProcess :: [CommandParam] -> Repo -> CreateProcess gitCreateProcess params repo = |