mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
ci/cron/check: use whileJust_ for recursion (#7747)
As suggested in #7746. CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
1d638c29cb
commit
cdf6160c76
@ -19,8 +19,9 @@ da_haskell_binary(
|
||||
"http-client",
|
||||
"http-client-tls",
|
||||
"http-types",
|
||||
"optparse-applicative",
|
||||
"monad-loops",
|
||||
"network-uri",
|
||||
"optparse-applicative",
|
||||
"process",
|
||||
"regex-tdfa",
|
||||
"semver",
|
||||
|
@ -12,6 +12,7 @@ import qualified Control.Concurrent.QSem
|
||||
import qualified Control.Exception
|
||||
import qualified Control.Monad as Control
|
||||
import qualified Control.Monad.Extra
|
||||
import qualified Control.Monad.Loops
|
||||
import qualified Data.Aeson as JSON
|
||||
import qualified Data.ByteString
|
||||
import qualified Data.ByteString.UTF8 as BS
|
||||
@ -285,13 +286,11 @@ download_assets tmp release = do
|
||||
HTTP.withResponse req manager (\resp -> do
|
||||
let body = HTTP.responseBody resp
|
||||
IO.withBinaryFile (tmp </> (last $ Network.URI.pathSegments url)) IO.AppendMode (\handle -> do
|
||||
let loop = do
|
||||
bs <- HTTP.brRead body
|
||||
if Data.ByteString.null bs then return ()
|
||||
else do
|
||||
Data.ByteString.hPut handle bs
|
||||
loop
|
||||
loop))))
|
||||
while (readFrom body) (writeTo handle)))))
|
||||
where while = Control.Monad.Loops.whileJust_
|
||||
readFrom body = ifNotEmpty <$> HTTP.brRead body
|
||||
ifNotEmpty bs = if Data.ByteString.null bs then Nothing else Just bs
|
||||
writeTo = Data.ByteString.hPut
|
||||
|
||||
verify_signatures :: FilePath -> FilePath -> String -> IO String
|
||||
verify_signatures bash_lib tmp version_tag = do
|
||||
|
Loading…
Reference in New Issue
Block a user