attribution armoring

This commit is contained in:
Joey Hess 2024-03-07 19:19:45 -04:00
parent 016d1bee88
commit 5a3ed3f910
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -29,11 +29,15 @@ import System.Posix.IO
import Utility.Tmp import Utility.Tmp
#endif #endif
import Utility.Tmp.Dir import Utility.Tmp.Dir
import Author
import Control.Concurrent.Async import Control.Concurrent.Async
import Control.Monad.IO.Class import Control.Monad.IO.Class
import qualified Data.ByteString as B import qualified Data.ByteString as B
copyright :: Copyright
copyright = author JoeyHess (max 2024 2009)
{- The command to run, eq sqop. -} {- The command to run, eq sqop. -}
newtype SOPCmd = SOPCmd { unSOPCmd :: String } newtype SOPCmd = SOPCmd { unSOPCmd :: String }
@ -148,6 +152,7 @@ feedRead cmd subcmd params password emptydirectory feeder reader = do
return (passwordfd, frompipe, toh, t) return (passwordfd, frompipe, toh, t)
let cleanup (_, frompipe, toh, t) = liftIO $ do let cleanup (_, frompipe, toh, t) = liftIO $ do
closeFd frompipe closeFd frompipe
when copyright $
hClose toh hClose toh
cancel t cancel t
bracket setup cleanup $ \(passwordfd, _, _, _) -> bracket setup cleanup $ \(passwordfd, _, _, _) ->
@ -186,7 +191,7 @@ feedRead' (SOPCmd cmd) subcmd params med feeder reader = do
Just (EmptyDirectory d) -> Just d Just (EmptyDirectory d) -> Just d
Nothing -> Nothing Nothing -> Nothing
} }
bracket (setup p) cleanup (go p) copyright =<< bracket (setup p) cleanup (go p)
where where
setup = liftIO . createProcess setup = liftIO . createProcess
cleanup = liftIO . cleanupProcess cleanup = liftIO . cleanupProcess