diff --git a/lib/Rofi/Command.hs b/lib/Rofi/Command.hs index 76766ec..ea6edff 100644 --- a/lib/Rofi/Command.hs +++ b/lib/Rofi/Command.hs @@ -152,9 +152,7 @@ readCmdEither -> [T.Text] -> T.Text -> IO (Either (Int, T.Text, T.Text) T.Text) -readCmdEither cmd args input = - resultToEither - <$> readProcessWithExitCode (T.unpack cmd) (fmap T.unpack args) (T.unpack input) +readCmdEither cmd args input = readCmdEither' cmd args input [] readCmdEither' :: T.Text @@ -166,10 +164,10 @@ readCmdEither' cmd args input environ = resultToEither <$> readCreateProcessWithExitCode p (T.unpack input) where - p = - (proc (T.unpack cmd) (fmap T.unpack args)) - { env = Just $ fmap (bimap T.unpack T.unpack) environ - } + e = case environ of + [] -> Nothing + es -> Just $ fmap (bimap T.unpack T.unpack) es + p = (proc (T.unpack cmd) (fmap T.unpack args)) {env = e} resultToEither :: (ExitCode, String, String)