Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import System.Directory qualified as Permissions (Permissions (..))
import System.Environment (getExecutablePath)
import System.Exit (ExitCode, exitFailure)
import System.FilePath ((</>))
import System.IO (stderr)
import System.IO qualified as IO
import UnliftIO.Exception (Exception (..), SomeException (..), handleJust)

{----- CLI Options -----}
Expand Down Expand Up @@ -151,6 +151,9 @@ loadCLIOptions =

main :: IO ()
main = handleErrors $ do
IO.hSetEncoding IO.stdout IO.utf8
IO.hSetEncoding IO.stderr IO.utf8

cli <- loadCLIOptions

git <- initGitClient
Expand Down Expand Up @@ -185,7 +188,7 @@ resolveFiles git cmd =

handleErrors :: IO a -> IO a
handleErrors = handleJust shouldHandle $ \(SomeException e) -> do
TextL.hPutStrLn stderr . Term.red $ (TextL.strip . TextL.pack . displayException) e
TextL.hPutStrLn IO.stderr . Term.red $ (TextL.strip . TextL.pack . displayException) e
exitFailure
where
shouldHandle (SomeException e) = do
Expand Down