Skip to content

Commit

Permalink
cachix-deployment: create a new group when running a deployment
Browse files Browse the repository at this point in the history
This is to ensure that process monitors don't kill the deployment
when restarting the agent (usually due to an upgrade).
  • Loading branch information
domenkozar committed Jul 9, 2022
1 parent 10166f2 commit 9d33855
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cachix/src/Cachix/Deploy/StdinProcess.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ import Prelude (String, userError)
-- | Run a process with only stdin as an input
readProcess :: FilePath -> [String] -> String -> IO ()
readProcess cmd args input = do
(Just stdin, _, _, ph) <- createProcess (proc cmd args) {std_in = CreatePipe}
(Just stdin, _, _, ph) <-
createProcess
(proc cmd args)
{ std_in = CreatePipe,
-- When launching cachix-deployment we need to make sure it's not killed when the main process is killed
create_group = True,
-- Same, but with posix api
new_session = True
}
hPutStr stdin input
hClose stdin
exitcode <- waitForProcess ph
Expand Down

0 comments on commit 9d33855

Please sign in to comment.