summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorstuebinm2022-02-12 17:14:24 +0100
committerstuebinm2022-03-19 19:26:32 +0100
commit4017daeae6e22067f687e7e0edb072e5f7808627 (patch)
treefbe2cba2931736421ceb919b5a64e2639932de17 /src
parentbe1089008a941da8afe23ca36f8209e0a08f58d4 (diff)
don't fail compilation if git is unavailable
(instead, `walint --version` will now just say "unknown")
Diffstat (limited to 'src')
-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) ++
")"