summaryrefslogtreecommitdiff
path: root/CmdLine
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-14 15:02:42 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-14 15:02:42 -0400
commitb9c249d46e582bf52b771368cfe9d8d455c11f9f (patch)
treed80ac8add3a7c560a8ec8cb148d6e1ae2effbe9e /CmdLine
parentcc13dd82c5cd7647f911ed6be1e58694f7edee31 (diff)
Work around problem with concurrent-output when in a non-unicode locale by avoiding use of it in such a locale.
Instead -J will behave as if it was built without concurrent-output support in this situation. Ie, it will be mostly quiet, except when there's an error. Note that it's not a problem for a filename to contain invalid utf-8 when in a utf-8 locale. That is handled ok by concurrent-output. It's only displaying unicode characters in a non-unicode locale that doesn't work.
Diffstat (limited to 'CmdLine')
-rw-r--r--CmdLine/Action.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/CmdLine/Action.hs b/CmdLine/Action.hs
index ec31c32f0..c1dd12b51 100644
--- a/CmdLine/Action.hs
+++ b/CmdLine/Action.hs
@@ -53,7 +53,7 @@ performCommandAction Command { cmdcheck = c, cmdname = name } seek cont = do
commandAction :: CommandStart -> Annex ()
commandAction a = withOutputType go
where
- go (ConcurrentOutput n) = do
+ go o@(ConcurrentOutput n _) = do
ws <- Annex.getState Annex.workers
(st, ws') <- if null ws
then do
@@ -63,7 +63,7 @@ commandAction a = withOutputType go
l <- liftIO $ drainTo (n-1) ws
findFreeSlot l
w <- liftIO $ async
- $ snd <$> Annex.run st (inOwnConsoleRegion run)
+ $ snd <$> Annex.run st (inOwnConsoleRegion o run)
Annex.changeState $ \s -> s { Annex.workers = Right w:ws' }
go _ = run
run = void $ includeCommandAction a
@@ -155,9 +155,13 @@ allowConcurrentOutput :: Annex a -> Annex a
allowConcurrentOutput a = go =<< Annex.getState Annex.concurrentjobs
where
go Nothing = a
- go (Just n) = Regions.displayConsoleRegions $
- bracket_ (setup n) cleanup a
- setup = Annex.setOutput . ConcurrentOutput
+ go (Just n) = ifM (liftIO concurrentOutputSupported)
+ ( Regions.displayConsoleRegions $
+ goconcurrent (ConcurrentOutput n True)
+ , goconcurrent (ConcurrentOutput n False)
+ )
+ goconcurrent o = bracket_ (setup o) cleanup a
+ setup = Annex.setOutput
cleanup = do
finishCommandActions
Annex.setOutput NormalOutput