filter out control characters and quote filenames

Searched for uses of putStr and hPutStr and changed appropriate ones to filter
out control characters and quote filenames.

This notably does not make find and findkeys quote filenames in their default
output. Because they should only do that when stdout is non a pipe.

A few commands like calckey and lookupkey seem too low-level to make sense to filter
output, so skipped those.

Also when relaying output from other commands that is not progress output,
have git-annex filter out control characters.

Sponsored-by: k0ld on Patreon
This commit is contained in:
Joey Hess 2023-04-11 14:27:22 -04:00
parent 11e89c5a29
commit df6f9f1ee8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
15 changed files with 75 additions and 39 deletions

View file

@ -53,6 +53,7 @@ import Utility.DataUnits
import Utility.HumanTime
import Utility.SimpleProtocol as Proto
import Utility.ThreadScheduler
import Utility.SafeOutput
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString as S
@ -321,7 +322,7 @@ demeterCommandEnv oh cmd params environ = do
where
stdouthandler l =
unless (quietMode oh) $
putStrLn l
putStrLn (safeOutput l)
{- To suppress progress output, while displaying other messages,
- filter out lines that contain \r (typically used to reset to the