From 7a5a254066edca25dc66b7aeb2a87f35ad846604 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 18 Jan 2016 13:01:23 -0400 Subject: Force output to be line-buffered, even when it's not connected to the terminal. This is particuarly important for commands with --batch output, which was not always being flushed at an appropriate time. --- Messages.hs | 5 +++++ debian/changelog | 3 +++ 2 files changed, 8 insertions(+) diff --git a/Messages.hs b/Messages.hs index ff26380dd..7b4cff102 100644 --- a/Messages.hs +++ b/Messages.hs @@ -182,6 +182,11 @@ setupConsole = do <*> pure preciseLogFormatter updateGlobalLogger rootLoggerName (setLevel NOTICE . setHandlers [s]) setConsoleEncoding + {- Force output to be line buffered. This is normally the case when + - it's connected to a terminal, but may not be when redirected to + - a file or a pipe. -} + hSetBuffering stdout LineBuffering + hSetBuffering stderr LineBuffering {- Log formatter with precision into fractions of a second. -} preciseLogFormatter :: LogFormatter a diff --git a/debian/changelog b/debian/changelog index 077e36e76..0817d0be3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ git-annex (6.20160115) UNRELEASED; urgency=medium * whereis --json: Urls are now listed inside the remote that claims them, rather than all together at the end. * info: Support --batch mode. + * Force output to be line-buffered, even when it's not connected to the + terminal. This is particuarly important for commands with --batch + output, which was not always being flushed at an appropriate time. -- Joey Hess Fri, 15 Jan 2016 14:05:01 -0400 -- cgit v1.2.3