Fix bug in logging

This commit is contained in:
Julian Ospald 2020-04-26 20:17:01 +02:00
parent 27e2e7f848
commit 931080244f
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28

View File

@ -199,6 +199,7 @@ execLogged exe spath args lfile chdir env = do
lineAction ref rs bs' = do
modifyIORef' ref (swapRegs bs')
regs <- readIORef ref
void $ SPIB.fdWrite fileFd (bs' <> "\n")
forM (zip regs rs) $ \(bs, r) -> do
setConsoleRegion r $ do
w <- consoleWidth
@ -210,8 +211,6 @@ execLogged exe spath args lfile chdir env = do
. trim w
. (\b -> "[ " <> toFilePath lfile <> " ] " <> b)
$ bs
SPIB.fdWrite fileFd (bs <> "\n")
swapRegs bs regs | length regs < size = regs ++ [bs]
| otherwise = tail regs ++ [bs]