mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-04-08 23:35:54 +00:00
* explicit exports * more empty exports * add exports * reorder * use correct ControlProtocol type for xftp router --------- Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
20 lines
512 B
Haskell
20 lines
512 B
Haskell
{-# LANGUAGE LambdaCase #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Simplex.Messaging.Server.Main.GitCommit
|
|
( gitCommit,
|
|
) where
|
|
|
|
import Language.Haskell.TH
|
|
import System.Process
|
|
import Control.Exception
|
|
import System.Exit
|
|
|
|
gitCommit :: Q Exp
|
|
gitCommit = stringE . commit =<< runIO (try $ readProcessWithExitCode "git" ["rev-parse", "HEAD"] "")
|
|
where
|
|
commit :: Either SomeException (ExitCode, String, String) -> String
|
|
commit = \case
|
|
Right (ExitSuccess, out, _) -> take 40 out
|
|
_ -> ""
|