From 92e057e4619d1ff4fe361d2d215a63ee0630a9a0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 10 Oct 2013 16:05:44 -0400 Subject: 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. --- Utility/Daemon.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Utility') diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs index 2f942769a..12beb235a 100644 --- a/Utility/Daemon.hs +++ b/Utility/Daemon.hs @@ -16,6 +16,7 @@ import Utility.LogFile #ifndef mingw32_HOST_OS import System.Posix +import Control.Concurrent.Async #else import System.PosixCompat #endif @@ -46,7 +47,9 @@ daemonize logfd pidfile changedirectory a = do nullfd <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags redir nullfd stdInput redirLog logfd - a + {- forkProcess masks async exceptions; unmask them inside + - the action. -} + wait =<< asyncWithUnmask (\unmask -> unmask a) out out = exitImmediately ExitSuccess #else -- cgit v1.2.3