summaryrefslogtreecommitdiff
path: root/Messages/Concurrent.hs
blob: 3b7b28d286500405d16e20f8c73654cf23da6f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{- git-annex concurrent output
 -
 - Copyright 2015 Joey Hess <id@joeyh.name>
 -
 - Licensed under the GNU GPL version 3 or higher.
 -}

{-# LANGUAGE CPP #-}

module Messages.Concurrent where

import Common.Annex
import Messages.Internal
import Types.Messages

#ifdef WITH_CONCURRENTOUTPUT
import qualified System.Console.Concurrent as Console
#endif

{- Enable concurrent output when that has been requested.
 -
 - This should only be run once per git-annex lifetime, with
 - everything that might generate messages run inside it.
 -}
withConcurrentOutput :: Annex a -> Annex a
#ifdef WITH_CONCURRENTOUTPUT
withConcurrentOutput a = withOutputType go
  where
	go (ConcurrentOutput _) = Console.withConcurrentOutput a
	go _ = a
#else
withConcurrentOutput = id
#endif