diff options
author | 2013-05-19 15:52:22 -0400 | |
---|---|---|
committer | 2013-05-19 15:52:22 -0400 | |
commit | d41405d7db435a65783178a8a31cc7f4b7f19023 (patch) | |
tree | 55d5b5f03f4c58702a27c0bf451ce92c027040b5 | |
parent | 482708643b9c2925f9054a63e51048ed8d5d9aa6 (diff) |
Fix a zombie that could result when running a process like gpg to read and write to it.
-rw-r--r-- | Utility/Process.hs | 7 | ||||
-rw-r--r-- | debian/changelog | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/Utility/Process.hs b/Utility/Process.hs index 6e0aef21c..cee727656 100644 --- a/Utility/Process.hs +++ b/Utility/Process.hs @@ -47,6 +47,7 @@ import System.Posix.IO #endif import Utility.Misc +import Utility.Exception type CreateProcessRunner = forall a. CreateProcess -> ((Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> IO a) -> IO a @@ -141,13 +142,13 @@ createProcessSuccess :: CreateProcessRunner createProcessSuccess p a = createProcessChecked (forceSuccessProcess p) p a {- Runs createProcess, then an action on its handles, and then - - an action on its exit code. -} + - a checker action on its exit code, which must wait for the process. -} createProcessChecked :: (ProcessHandle -> IO b) -> CreateProcessRunner createProcessChecked checker p a = do t@(_, _, _, pid) <- createProcess p - r <- a t + r <- tryNonAsync $ a t _ <- checker pid - return r + either E.throw return r {- Leaves the process running, suitable for lazy streaming. - Note: Zombies will result, and must be waited on. -} diff --git a/debian/changelog b/debian/changelog index 9ee201ab0..43bb13c14 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ git-annex (4.20130517) UNRELEASED; urgency=low Closes: #708619 * Switch to MonadCatchIO-transformers for better handling of state while catching exceptions. + * Fix a zombie that could result when running a process like gpg to + read and write to it. -- Joey Hess <joeyh@debian.org> Fri, 17 May 2013 11:17:03 -0400 |