From b9c249d46e582bf52b771368cfe9d8d455c11f9f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 14 Feb 2016 15:02:42 -0400 Subject: 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. --- CmdLine/Action.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'CmdLine') 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 -- cgit v1.2.3