unmask async exceptions after fork

Turns out that forkProcess masks async exceptions. Unmask them so that the
daemon code can use them for thread IPC.

There is some risk this introduces breakage in git-annex, but it would be
breakage that would already occur when the assistant was run with
--foreground.
This commit is contained in:
Joey Hess 2013-10-10 16:05:44 -04:00
parent 7abe6cb161
commit ebcbea4576

View file

@ -16,6 +16,7 @@ import Utility.LogFile
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
import System.Posix import System.Posix
import Control.Concurrent.Async
#else #else
import System.PosixCompat import System.PosixCompat
#endif #endif
@ -46,7 +47,9 @@ daemonize logfd pidfile changedirectory a = do
nullfd <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags nullfd <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags
redir nullfd stdInput redir nullfd stdInput
redirLog logfd redirLog logfd
a {- forkProcess masks async exceptions; unmask them inside
- the action. -}
wait =<< asyncWithUnmask (\unmask -> unmask a)
out out
out = exitImmediately ExitSuccess out = exitImmediately ExitSuccess
#else #else