REF use text in few more places
This commit is contained in:
parent
3dd2536f0f
commit
ec42f34905
|
@ -60,7 +60,7 @@ vmPID :: String -> IO (Maybe Int)
|
|||
vmPID vid = do
|
||||
(rc, out, _) <- readCreateProcessWithExitCode' cmd ""
|
||||
return $ case rc of
|
||||
ExitSuccess -> readMaybe out
|
||||
ExitSuccess -> readMaybe $ T.unpack out
|
||||
_ -> Nothing
|
||||
where
|
||||
cmd = proc "pgrep" ["-f", "VirtualBoxVM.*" ++ vid]
|
||||
|
|
|
@ -425,11 +425,13 @@ vpnPresent =
|
|||
go <$> tryIOError (readCreateProcessWithExitCode' (proc' "nmcli" args) "")
|
||||
where
|
||||
args = ["-c", "no", "-t", "-f", "TYPE", "c", "show"]
|
||||
go (Right (ExitSuccess, out, _)) = if "vpn" `elem` lines out then Nothing
|
||||
go (Right (ExitSuccess, out, _)) = if "vpn" `elem` T.lines out then Nothing
|
||||
else Just $ Msg Error "vpn not found"
|
||||
go (Right (ExitFailure c, _, err)) = Just $ Msg Error
|
||||
$ T.concat ["vpn search exited with code "
|
||||
, T.pack $ show c, ": ", T.pack err]
|
||||
, T.pack $ show c
|
||||
, ": "
|
||||
, err]
|
||||
go (Left e) = Just $ Msg Error $ T.pack $ show e
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
|
@ -15,6 +15,7 @@ import Data.Internal.Dependency
|
|||
import Data.List
|
||||
import Data.Maybe
|
||||
import Data.Monoid
|
||||
import Data.Text.IO (hPutStrLn)
|
||||
|
||||
import Graphics.X11.Types
|
||||
import Graphics.X11.Xlib.Atom
|
||||
|
@ -25,7 +26,9 @@ import qualified RIO.Text as T
|
|||
|
||||
import System.Directory
|
||||
import System.Environment
|
||||
import System.IO
|
||||
import System.IO hiding
|
||||
( hPutStrLn
|
||||
)
|
||||
import System.IO.Error
|
||||
import System.Process
|
||||
|
||||
|
@ -437,7 +440,6 @@ whenChanged v action = do
|
|||
logXinerama :: Handle -> X ()
|
||||
logXinerama h = withWindowSet $ \ws -> io
|
||||
$ hPutStrLn h
|
||||
$ T.unpack
|
||||
$ T.unwords
|
||||
$ filter (not . T.null) [onScreen ws, offScreen ws, sep, layout ws, nWindows ws]
|
||||
where
|
||||
|
|
|
@ -23,6 +23,8 @@ import Control.Monad.IO.Class
|
|||
|
||||
import Data.Maybe
|
||||
|
||||
import qualified RIO.Text as T
|
||||
|
||||
import System.Directory
|
||||
import System.Exit
|
||||
import System.IO
|
||||
|
@ -62,9 +64,11 @@ addGroupSession cp = cp { create_group = True, new_session = True }
|
|||
createProcess' :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
|
||||
createProcess' = withDefaultSignalHandlers . createProcess
|
||||
|
||||
readCreateProcessWithExitCode' :: CreateProcess -> String -> IO (ExitCode, String, String)
|
||||
readCreateProcessWithExitCode' c i = withDefaultSignalHandlers
|
||||
$ readCreateProcessWithExitCode c i
|
||||
readCreateProcessWithExitCode' :: CreateProcess -> String
|
||||
-> IO (ExitCode, T.Text, T.Text)
|
||||
readCreateProcessWithExitCode' c i = withDefaultSignalHandlers $ do
|
||||
(r, e, p) <- readCreateProcessWithExitCode c i
|
||||
return (r, T.pack e, T.pack p)
|
||||
|
||||
shell' :: String -> CreateProcess
|
||||
shell' = addGroupSession . shell
|
||||
|
|
Loading…
Reference in New Issue