Skip to content

Commit

Permalink
Merge pull request #652 from cachix/fix-sigpipe-macos
Browse files Browse the repository at this point in the history
fix: ignore sigPIPE on macOS after initialising nix
  • Loading branch information
sandydoo committed May 22, 2024
2 parents 7ba2cad + db7f8fa commit 56bbfa5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cachix/src/Cachix/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ main = displayConsoleRegions $ do
(flags, command) <- getOpts
env <- mkEnv flags

installSignalHandlers

initNixStore

installSignalHandlers

let cachixOptions = cachixoptions env
case command of
AuthToken token -> Commands.authtoken env token
Expand All @@ -52,8 +52,8 @@ main = displayConsoleRegions $ do
installSignalHandlers :: IO ()
installSignalHandlers = do
-- Ignore sigPIPE.
-- By default, sigPIPE will crash the entire program when the reading end of a pipe is closed.
-- By ignoring sigPIPE, an exception is thrown inline instead, which we can handle.
-- The default handler terminates the process.
-- WARN: may be reset to SIG_DFL when initializing the Nix library.
_ <- Signal.installHandler Signal.sigPIPE Signal.Ignore Nothing

return ()
Expand Down

0 comments on commit 56bbfa5

Please sign in to comment.