Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: b1d2ece186
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (28 sloc) 0.905 kB
{-# LANGUAGE OverloadedStrings #-}
import Control.Exception
import Control.Concurrent
import Data.Configurator
import Data.Configurator.Types
import qualified Data.ByteString.Lazy.Char8 as L
import System.Environment
import System.Directory
import Control.Monad
import System.IO
main = do
args <- getArgs
tmpDir <- getTemporaryDirectory
temps <- forM args $ \arg -> do
(p,h) <- openBinaryTempFile tmpDir "test.cfg"
L.hPut h =<< L.readFile arg
hClose h
return p
flip finally (mapM_ removeFile temps) $ do
done <- newEmptyMVar
let myConfig = autoConfig {
onError = \e -> hPutStrLn stderr $ "uh oh: " ++ show e
(c,_) <- autoReload myConfig temps
display c
subscribe c "dongly" $ \n v -> print (n,v) >> putMVar done ()
forM_ temps $ \t -> L.appendFile t "\ndongly = 1\n"
takeMVar done
Jump to Line
Something went wrong with that request. Please try again.