Skip to content
Snippets Groups Projects
Commit 4017daea authored by stuebinm's avatar stuebinm
Browse files

don't fail compilation if git is unavailable

(instead, `walint --version` will now just say "unknown")
parent be108900
No related branches found
No related tags found
No related merge requests found
......@@ -6,10 +6,12 @@ module Version ( version ) where
import Control.Monad.Trans (liftIO)
import qualified Language.Haskell.TH as TH
import System.Process (readProcess)
import GHC.IO (catchAny)
version :: String
version = "walint rc3 2021 (" <>
$(do
hash <- liftIO $ readProcess "git" ["rev-parse", "HEAD"] ""
hash <- liftIO $ catchAny (readProcess "git" ["rev-parse", "HEAD"] "")
(\_ -> pure "[unknown]")
pure . TH.LitE . TH.StringL $ take 40 hash) ++
")"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment