Skip to content

Commit

Permalink
Don't write log messages to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Nov 7, 2024
1 parent 1a8b632 commit 9f244dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Juvix/Data/Effect/Git/Process.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ gitHeadRef = gitNormalizeRef "HEAD"

-- | Checkout the clone at a particular ref
gitCheckout :: (Members '[TaggedLock, ProcessE, Error GitProcessError, Reader CloneEnv] r) => Text -> Sem r ()
gitCheckout ref = withTaggedLockDir' (void (runGitCmdInDir ["checkout", ref]))
gitCheckout ref = withTaggedLockDir' (void (runGitCmdInDir ["checkout", "-q", ref]))

-- | Fetch in the clone
gitFetch :: (Members '[TaggedLock, ProcessE, Error GitProcessError, Reader CloneEnv, Internet] r) => Sem r ()
gitFetch = whenHasInternet gitFetchOnline

gitFetchOnline :: (Members '[TaggedLock, Reader CloneEnv, Error GitProcessError, ProcessE, Online] r) => Sem r ()
gitFetchOnline = withTaggedLockDir' (void (runGitCmdInDir ["fetch"]))
gitFetchOnline = withTaggedLockDir' (void (runGitCmdInDir ["fetch", "-q"]))

gitCloneOnline :: (Members '[Log, Error GitProcessError, ProcessE, Online, Reader CloneEnv] r) => Text -> Sem r ()
gitCloneOnline url = do
p <- asks (^. cloneEnvDir)
log ("Cloning " <> url <> " to " <> pack (toFilePath p))
void (runGitCmd ["clone", url, T.pack (toFilePath p)])
void (runGitCmd ["clone", "-q", url, T.pack (toFilePath p)])

cloneGitRepo :: (Members '[Log, Files, ProcessE, Error GitProcessError, Reader CloneEnv, Internet] r) => Text -> Sem r ()
cloneGitRepo = whenHasInternet . gitCloneOnline
Expand Down
2 changes: 1 addition & 1 deletion src/Juvix/Data/Effect/Log.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runLogIO ::
Sem (Log ': r) a ->
Sem r a
runLogIO sem = do
liftIO (hSetBuffering stdout LineBuffering)
liftIO (hSetBuffering stderr LineBuffering)
interpret
( \case
Log txt -> putStrLn txt
Expand Down

0 comments on commit 9f244dc

Please sign in to comment.