avoid failure when gpgconf is not in path
authorJoey Hess <joeyh@joeyh.name>
Tue, 8 Sep 2020 16:21:24 +0000 (12:21 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 8 Sep 2020 16:21:24 +0000 (12:21 -0400)
Utility/Gpg.hs
Utility/SafeCommand.hs

index 650ef450eebbdb2c0284f00af76110776846bc9c..e5796dd55a3b68c7fd54f9a271ffb805d5a18279 100644 (file)
@@ -439,8 +439,8 @@ testHarness tmpdir cmd a = ifM (inPath (unGpgCmd cmd))
        -- other daemons. Stop them when done. This only affects
        -- daemons started for the GNUPGHOME that was used.
        -- Older gpg may not support this, so ignore failure.
-       stopgpgagent = void $ boolSystem "gpgconf"
-               [Param "--kill", Param "all"]
+       stopgpgagent = whenM (inPath "gpgconf") $
+               void $ boolSystem "gpgconf" [Param "--kill", Param "all"]
 
        go (Just _) = Just <$> a
        go Nothing = return Nothing
index bb467aca3f366fbfac3449365ff25849f5d0f8d4..51e151e0f37398e946df98dda349ab23682f7331 100644 (file)
@@ -61,6 +61,8 @@ toCommand' (File s) = s
 
 -- | Run a system command, and returns True or False if it succeeded or failed.
 --
+-- (Throws an exception if the command is not found.)
+--
 -- This and other command running functions in this module log the commands
 -- run at debug level, using System.Log.Logger.
 boolSystem :: FilePath -> [CommandParam] -> IO Bool