diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Reaktor/Plugins/System.hs | 10 | ||||
-rw-r--r-- | src/Reaktor/Plugins/System/Internal.hs | 16 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/Reaktor/Plugins/System.hs b/src/Reaktor/Plugins/System.hs index 864bbc3..8ca468c 100644 --- a/src/Reaktor/Plugins/System.hs +++ b/src/Reaktor/Plugins/System.hs @@ -90,7 +90,7 @@ run1 Config{..} Actions{..} Hook{..} prefix msgtarget text = do name = case hCommand of Capture i -> fromMaybe "<unnamed>" (capture i) - CaptureOr Command{..} -> T.pack $ takeBaseName $ commandPath + CaptureOr SystemCommand{..} -> T.pack $ takeBaseName $ scPath command = case hCommand of @@ -106,7 +106,7 @@ run1 Config{..} Actions{..} Hook{..} prefix msgtarget text = do CaptureOr s -> Just s case command of - Just Command{..} -> do + Just SystemCommand{..} -> do baseEnv <- getEnvironment let @@ -138,13 +138,13 @@ run1 Config{..} Actions{..} Hook{..} prefix msgtarget text = do env = M.toList $ mconcat [ M.fromList extraEnv - , maybe mempty id commandEnv + , maybe mempty id scEnv , M.fromList baseEnv ] - cwd = commandWorkDir <|> hWorkDir <|> cWorkDir + cwd = scWorkDir <|> hWorkDir <|> cWorkDir - fork commandPath args cwd (Just env) "" hTimeout Callbacks{..} + fork scPath args cwd (Just env) "" hTimeout Callbacks{..} Nothing -> do let s = name <> ": command not found" diff --git a/src/Reaktor/Plugins/System/Internal.hs b/src/Reaktor/Plugins/System/Internal.hs index d042217..78c8802 100644 --- a/src/Reaktor/Plugins/System/Internal.hs +++ b/src/Reaktor/Plugins/System/Internal.hs @@ -49,10 +49,10 @@ instance FromJSON Config where data Hook = Hook { hActivate :: Activate , hPattern :: Maybe Regex - , hCommand :: CaptureOr Command + , hCommand :: CaptureOr SystemCommand , hArguments :: [CaptureOr Text] , hWorkDir :: Maybe FilePath - , hCommands :: HashMap Text Command + , hCommands :: HashMap Text SystemCommand , hTimeout :: Maybe Int } deriving Show @@ -71,17 +71,17 @@ instance FromJSON Hook where _ -> undefined -data Command = Command - { commandPath :: FilePath - , commandWorkDir :: Maybe FilePath - , commandEnv :: Maybe (HashMap String String) +data SystemCommand = SystemCommand + { scPath :: FilePath + , scWorkDir :: Maybe FilePath + , scEnv :: Maybe (HashMap String String) } deriving Show -instance FromJSON Command where +instance FromJSON SystemCommand where parseJSON = \case Object v -> - Command + SystemCommand <$> v .: "filename" <*> v .:? "workdir" <*> v .:? "env" |