From b939d9665d7d03d4858cfc21050b97abe47accb9 Mon Sep 17 00:00:00 2001 From: Jon Doe Date: Mon, 14 Sep 2020 15:46:45 +0200 Subject: [PATCH] add pipe for plugins --- src/GypsFulvus.hs | 2 +- src/GypsFulvus/PluginStuff.hs | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/GypsFulvus.hs b/src/GypsFulvus.hs index 63a6e00..2c7c34b 100644 --- a/src/GypsFulvus.hs +++ b/src/GypsFulvus.hs @@ -1,4 +1,4 @@ -module GypsFulvus(execMain) where +module GypsFulvus(execMain, Manhole, Sewage) where import Control.Concurrent.STM (atomically, retry) import Control.Concurrent.STM.TMVar import Control.Concurrent.STM.TChan diff --git a/src/GypsFulvus/PluginStuff.hs b/src/GypsFulvus/PluginStuff.hs index b416703..b7b3149 100644 --- a/src/GypsFulvus/PluginStuff.hs +++ b/src/GypsFulvus/PluginStuff.hs @@ -1,13 +1,21 @@ -module GypsFulvus.PluginStuff(loadCommsPlugins) where +module GypsFulvus.PluginStuff(loadCommsPlugins, Sewage, Manhole) where import Control.Monad import System.Directory import System.Plugins.Make import Data.Maybe import Control.Concurrent.STM import Control.Concurrent.STM.TMVar +import qualified Data.Text as T +data Sewage = Sewage { + getSewageAuthor :: T.Text, + getSewage :: T.Text + } +data Manhole = Manhole { + getInputChan :: TChan Sewage, + getOutputChan :: TChan Sewage} srcPluginPath :: IO FilePath -srcPluginPath = getXdgDirectory XdgData "gypsfulvus/src_plugins" >>= makeAbsolute +srcPluginPath = getXdgDirectory XdgData "gypsfulvus/srcplugins" >>= makeAbsolute configPath :: IO FilePath @@ -33,10 +41,7 @@ loadCommsPlugins canary collectorChannel = s <- mapM (\hng -> makeAll hng ["-v","-dynamic"]) rff mapM (\s' -> case s' of MakeSuccess _ p -> putStrLn p - MakeFailure e -> do - putStrLn $ show e - - return ()) s + MakeFailure e -> putStrLn $ show e) s _ <- atomically $ swapTMVar canary True -- I don't actually want to quit here but I don't like errors from STM heuristics when the canary is GCed