Fix a zombie that could result when running a process like gpg to read and write to it.
This commit is contained in:
parent
6d7d5f1be9
commit
1c72e0709b
2 changed files with 6 additions and 3 deletions
|
@ -47,6 +47,7 @@ import System.Posix.IO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
import Utility.Misc
|
import Utility.Misc
|
||||||
|
import Utility.Exception
|
||||||
|
|
||||||
type CreateProcessRunner = forall a. CreateProcess -> ((Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> IO a) -> IO a
|
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
|
createProcessSuccess p a = createProcessChecked (forceSuccessProcess p) p a
|
||||||
|
|
||||||
{- Runs createProcess, then an action on its handles, and then
|
{- 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 :: (ProcessHandle -> IO b) -> CreateProcessRunner
|
||||||
createProcessChecked checker p a = do
|
createProcessChecked checker p a = do
|
||||||
t@(_, _, _, pid) <- createProcess p
|
t@(_, _, _, pid) <- createProcess p
|
||||||
r <- a t
|
r <- tryNonAsync $ a t
|
||||||
_ <- checker pid
|
_ <- checker pid
|
||||||
return r
|
either E.throw return r
|
||||||
|
|
||||||
{- Leaves the process running, suitable for lazy streaming.
|
{- Leaves the process running, suitable for lazy streaming.
|
||||||
- Note: Zombies will result, and must be waited on. -}
|
- Note: Zombies will result, and must be waited on. -}
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -4,6 +4,8 @@ git-annex (4.20130517) UNRELEASED; urgency=low
|
||||||
Closes: #708619
|
Closes: #708619
|
||||||
* Switch to MonadCatchIO-transformers for better handling of state while
|
* Switch to MonadCatchIO-transformers for better handling of state while
|
||||||
catching exceptions.
|
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
|
-- Joey Hess <joeyh@debian.org> Fri, 17 May 2013 11:17:03 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue