Fix docs cron again (#8208)

Unfortunately, I missed the fact that we had our own logic for
handling process failures which resulted in uncatchable
exceptions. I’ve changed one place to use the upstream handling and
the other to call `fail` which throws an IOException like I would have
expected.

changelog_begin
changelog_end
This commit is contained in:
Moritz Kiefer 2020-12-08 22:06:22 +01:00 committed by GitHub
parent 0c7791bc1c
commit ec0fcb39f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,9 +43,9 @@ shell_exit_code :: String -> IO (Exit.ExitCode, String, String)
shell_exit_code cmd = do
System.readCreateProcessWithExitCode (System.shell cmd) ""
die :: String -> Exit.ExitCode -> String -> String -> IO a
die cmd (Exit.ExitFailure exit) out err =
Exit.die $ unlines ["Subprocess:",
die :: String -> Int -> String -> String -> IO a
die cmd exit out err =
fail $ unlines ["Subprocess:",
cmd,
"failed with exit code " <> show exit <> "; output:",
"---",
@ -55,15 +55,9 @@ die cmd (Exit.ExitFailure exit) out err =
"---",
err,
"---"]
die _ _ _ _ = Exit.die "Type system too weak."
shell :: String -> IO String
shell cmd = do
(exit, out, err) <- shell_exit_code cmd
if exit == Exit.ExitSuccess
then return out
else die cmd exit out err
shell cmd = System.readCreateProcess (System.shell cmd) ""
shell_ :: String -> IO ()
shell_ cmd = do
@ -78,9 +72,9 @@ robustly_download_nix_packages = do
(exit, out, err) <- shell_exit_code cmd
case (exit, n) of
(Exit.ExitSuccess, _) -> return ()
(_, 0) -> die cmd exit out err
(Exit.ExitFailure exit, 0) -> die cmd exit out err
_ | "unexpected end-of-file" `Data.List.isInfixOf` err -> h (n - 1)
_ -> die cmd exit out err
(Exit.ExitFailure exit, _) -> die cmd exit out err
add_github_contact_header :: HTTP.Request -> HTTP.Request
add_github_contact_header req =