...so that we do not accumulate open file descriptors. Signed-off-by: Klaus Aehlig <[email protected]> --- src/Ganeti/Query/Exec.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Ganeti/Query/Exec.hs b/src/Ganeti/Query/Exec.hs index 8e7ca06..b64b78d 100644 --- a/src/Ganeti/Query/Exec.hs +++ b/src/Ganeti/Query/Exec.hs @@ -62,6 +62,7 @@ module Ganeti.Query.Exec import Control.Concurrent (rtsSupportsBoundThreads) import Control.Concurrent.Lifted (threadDelay) +import Control.Exception (finally) import Control.Monad import Control.Monad.Error import Data.Functor @@ -194,8 +195,9 @@ runJobProcess jid s = withErrorLogAt CRITICAL (show jid) $ forkWithPipe :: ConnectConfig -> (Client -> IO ()) -> IO (ProcessID, Client) forkWithPipe conf childAction = do (master, child) <- pipeClient conf - pid <- forkProcess (closeClient master >> childAction child) - closeClient child + pid <- finally + (forkProcess (closeClient master >> childAction child)) + $ closeClient child return (pid, master) -- | Forks the job process and starts processing of the given job. -- 2.2.0.rc0.207.ga3a616c
