improve output when storing to bup

bup split outputs to stderr even with -q. This was discarded when using -J,
but it was still outputting when not using -J, and so was git-annex.

Sponsored-by: Nicholas Golder-Manning on Patreon
This commit is contained in:
Joey Hess 2022-08-05 12:29:33 -04:00
parent a23fd7349f
commit f94908f2a6
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 8 additions and 10 deletions

View file

@ -13,6 +13,7 @@ git-annex (10.20220725) UNRELEASED; urgency=medium
* add --dry-run: New option.
* Work around bug in git 2.37 that causes a segfault
when when core.untrackedCache is set, and broke git-annex init.
* Improve output when storing to bup.
-- Joey Hess <id@joeyh.name> Mon, 25 Jul 2022 15:35:45 -0400

View file

@ -155,22 +155,19 @@ bupSplitParams r buprepo k src =
store :: Remote -> BupRepo -> Storer
store r buprepo = byteStorer $ \k b p -> do
showOutput -- make way for bup output
quiet <- commandProgressDisabled
liftIO $ withNullHandle $ \nullh ->
let params = bupSplitParams r buprepo k []
cmd = (proc "bup" (toCommand params))
{ std_in = CreatePipe }
cmd' = if quiet
then cmd
{ std_out = UseHandle nullh
, std_err = UseHandle nullh
}
else cmd
{ std_in = CreatePipe
, std_out = UseHandle nullh
-- bup split is noisy to stderr even with the -q
-- option.
, std_err = UseHandle nullh
}
feeder = \h -> do
meteredWrite p (S.hPut h) b
hClose h
in withCreateProcess cmd' (go feeder cmd')
in withCreateProcess cmd (go feeder cmd)
where
go feeder p (Just h) _ _ pid =
forceSuccessProcess p pid