summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuebinm2022-02-12 17:14:24 +0100
committerstuebinm2022-02-12 17:14:24 +0100
commit6f604d3b0f63d7ceafc95e3a2726c79bb30d51d5 (patch)
treefa4b195e1f2e5fd770d6e1c28afe6cb615afa643
parent73f374daa24c52292069fb1a9b178fa98173042e (diff)
don't fail compilation if git is unavailable
(instead, `walint --version` will now just say "unknown")
Diffstat (limited to '')
-rw-r--r--src/Version.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Version.hs b/src/Version.hs
index 6679ae1..c0f7edf 100644
--- a/src/Version.hs
+++ b/src/Version.hs
@@ -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) ++
")"