add gitAnnexTmpWorkDir and withTmpWorkDir
Needed to run youtube-dl in, but could also be useful for other stuff. The tricky part of this was making the workdir be cleaned up whenever the tmp object file is cleaned up. This commit was sponsored by Ole-Morten Duesund on Patreon.
This commit is contained in:
parent
3febb79c8f
commit
4e7e1fcff4
4 changed files with 59 additions and 8 deletions
|
@ -107,7 +107,7 @@ fileRetriever :: (FilePath -> Key -> MeterUpdate -> Annex ()) -> Retriever
|
|||
fileRetriever a k m callback = do
|
||||
f <- prepTmp k
|
||||
a f k m
|
||||
callback (FileContent f)
|
||||
pruneTmpWorkDirBefore f (callback . FileContent)
|
||||
|
||||
-- A Retriever that generates a lazy ByteString containing the Key's
|
||||
-- content, and passes it to a callback action which will fully consume it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue