Merge remote-tracking branch 'origin/merge-requests/231'
This commit is contained in:
commit
655ee432f8
@ -35,6 +35,7 @@ import Data.Sequence ( Seq, (|>) )
|
|||||||
import Data.List
|
import Data.List
|
||||||
import Data.Word8
|
import Data.Word8
|
||||||
import GHC.IO.Exception
|
import GHC.IO.Exception
|
||||||
|
import System.IO ( stderr )
|
||||||
import System.IO.Error
|
import System.IO.Error
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import System.Directory
|
import System.Directory
|
||||||
@ -142,14 +143,14 @@ execLogged exe args chdir lfile env = do
|
|||||||
printToRegion :: Fd -> Fd -> Int -> MVar Bool -> Bool -> IO ()
|
printToRegion :: Fd -> Fd -> Int -> MVar Bool -> Bool -> IO ()
|
||||||
printToRegion fileFd fdIn size pState no_color = do
|
printToRegion fileFd fdIn size pState no_color = do
|
||||||
-- init region
|
-- init region
|
||||||
forM_ [1..size] $ \_ -> BS.putStr "\n"
|
forM_ [1..size] $ \_ -> BS.hPut stderr "\n"
|
||||||
|
|
||||||
void $ flip runStateT mempty
|
void $ flip runStateT mempty
|
||||||
$ do
|
$ do
|
||||||
handle
|
handle
|
||||||
(\(ex :: SomeException) -> do
|
(\(ex :: SomeException) -> do
|
||||||
ps <- liftIO $ takeMVar pState
|
ps <- liftIO $ takeMVar pState
|
||||||
when ps (liftIO $ BS.putStr (pos1 <> moveLineUp size <> clearScreen))
|
when ps (liftIO $ BS.hPut stderr (pos1 <> moveLineUp size <> clearScreen))
|
||||||
throw ex
|
throw ex
|
||||||
) $ readTilEOF lineAction fdIn
|
) $ readTilEOF lineAction fdIn
|
||||||
|
|
||||||
@ -184,7 +185,7 @@ execLogged exe args chdir lfile env = do
|
|||||||
Just (TP.Window _ w) -> do
|
Just (TP.Window _ w) -> do
|
||||||
regs <- get
|
regs <- get
|
||||||
liftIO $ forM_ (Sq.zip regs (Sq.fromList [0..(Sq.length regs - 1)])) $ \(bs, i) -> do
|
liftIO $ forM_ (Sq.zip regs (Sq.fromList [0..(Sq.length regs - 1)])) $ \(bs, i) -> do
|
||||||
BS.putStr
|
BS.hPut stderr
|
||||||
. overwriteNthLine (size - i)
|
. overwriteNthLine (size - i)
|
||||||
. trim w
|
. trim w
|
||||||
. blue
|
. blue
|
||||||
|
@ -196,7 +196,8 @@ execLogged exe args chdir lfile env = do
|
|||||||
then pure ()
|
then pure ()
|
||||||
else do
|
else do
|
||||||
void $ BS.appendFile logFile some
|
void $ BS.appendFile logFile some
|
||||||
void $ BS.hPut stdout some
|
-- subprocess stdout also goes to stderr for logging
|
||||||
|
void $ BS.hPut stderr some
|
||||||
go
|
go
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user