From 4d63a9f0ad327cba305e239e51d02e5e33213eda Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Nov 2015 13:37:49 -0400 Subject: run editor processes in foreground --- src/Propellor/Gpg.hs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/Propellor/Gpg.hs') diff --git a/src/Propellor/Gpg.hs b/src/Propellor/Gpg.hs index 60b0d52d..9c58a5d1 100644 --- a/src/Propellor/Gpg.hs +++ b/src/Propellor/Gpg.hs @@ -16,6 +16,7 @@ import Utility.Monad import Utility.Misc import Utility.Tmp import Utility.FileSystemEncoding +import Utility.ConcurrentOutput type KeyId = String @@ -111,10 +112,7 @@ gitCommitKeyRing action = do -- Commit explicitly the keyring and privdata files, as other -- changes may be staged by the user and shouldn't be committed. tocommit <- filterM doesFileExist [ privDataFile, keyring] - gitCommit $ (map File tocommit) ++ - [ Param "-m" - , Param ("propellor " ++ action) - ] + gitCommit (Just ("propellor " ++ action)) (map File tocommit) -- Adds --gpg-sign if there's a keyring. gpgSignParams :: [CommandParam] -> IO [CommandParam] @@ -124,10 +122,17 @@ gpgSignParams ps = ifM (doesFileExist keyring) ) -- Automatically sign the commit if there'a a keyring. -gitCommit :: [CommandParam] -> IO Bool -gitCommit ps = do - ps' <- gpgSignParams ps - boolSystem "git" (Param "commit" : ps') +gitCommit :: Maybe String -> [CommandParam] -> IO Bool +gitCommit msg ps = do + let ps' = Param "commit" : ps ++ + maybe [] (\m -> [Param "-m", Param m]) msg + ps'' <- gpgSignParams ps' + if isNothing msg + then do + (_, _, _, p) <- createProcessForeground $ + proc "git" (toCommand ps'') + checkSuccessProcess p + else boolSystem "git" ps'' gpgDecrypt :: FilePath -> IO String gpgDecrypt f = ifM (doesFileExist f) -- cgit v1.2.3