version: Avoid error message when entire output is not read

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2023-05-19 15:00:57 -04:00
parent 39f33a9988
commit 0f89d221bd
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 32 additions and 1 deletions

View file

@ -78,5 +78,6 @@ showRawVersion = do
putStr BuildInfo.packageversion
hFlush stdout -- no newline, so flush
-- Ignore failure to write so that this command can eg be piped to head.
vinfo :: String -> String -> IO ()
vinfo k v = putStrLn $ k ++ ": " ++ v
vinfo k v = void $ tryIO $ putStrLn $ k ++ ": " ++ v