use DynamicConfig to handle cost-command

This commit was sponsored by Jake Vosloo on Patreon.
This commit is contained in:
Joey Hess 2017-08-17 14:04:29 -04:00
parent 68a0f99ba6
commit 61e96621d8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 12 additions and 10 deletions

View file

@ -7,9 +7,9 @@
module Config.DynamicConfig where
import Control.Concurrent.STM
import Common
import Utility.SafeCommand
import Control.Concurrent.STM
-- | A configuration value that may only be known after performing an IO
-- action. The IO action will only be run the first time the configuration
@ -42,3 +42,6 @@ successfullCommandRunner cmd = boolSystem "sh" [Param "-c", Param cmd]
unsuccessfullCommandRunner :: CommandRunner Bool
unsuccessfullCommandRunner cmd = not <$> successfullCommandRunner cmd
readCommandRunner :: Read a => CommandRunner (Maybe a)
readCommandRunner cmd = readish <$> readProcess "sh" ["-c", cmd]