diff --git a/lib/XMonad/Internal/Shell.hs b/lib/XMonad/Internal/Shell.hs index 390d553..e91a0ed 100644 --- a/lib/XMonad/Internal/Shell.hs +++ b/lib/XMonad/Internal/Shell.hs @@ -22,13 +22,9 @@ where import RIO import qualified RIO.Text as T -import System.IO hiding (hSetBuffering) -import System.Posix.IO -import System.Posix.Process import qualified System.Process.Typed as P import qualified XMonad.Core as X - --- import qualified XMonad.Util.Run as XR +import qualified XMonad.Util.Run as XR -- | Fork a new process and wait for its exit code. -- @@ -93,30 +89,30 @@ spawnPipe :: (MonadReader env m, HasLogFunc env, MonadUnliftIO m) => T.Text -> m Handle -spawnPipe = spawnPipeRW +spawnPipe = liftIO . XR.spawnPipe . T.unpack -spawnPipeRW - :: (MonadReader env m, HasLogFunc env, MonadUnliftIO m) - => T.Text - -> m Handle -spawnPipeRW x = do - (r, h) <- liftIO mkPipe - child r - liftIO $ closeFd r - return h - where - mkPipe = do - (r, w) <- createPipe - setFdOption w CloseOnExec True - h <- fdToHandle w - -- ASSUME we are using utf8 everywhere - hSetEncoding h utf8 - hSetBuffering h LineBuffering - return (r, h) - child r = void $ withRunInIO $ \runIO -> do - X.xfork $ runIO $ do - void $ liftIO $ dupTo r stdInput - liftIO $ executeFile "/bin/sh" False ["-c", T.unpack x] Nothing +-- spawnPipeRW +-- :: (MonadReader env m, HasLogFunc env, MonadUnliftIO m) +-- => T.Text +-- -> m Handle +-- spawnPipeRW x = do +-- (r, h) <- liftIO mkPipe +-- child r +-- liftIO $ closeFd r +-- return h +-- where +-- mkPipe = do +-- (r, w) <- createPipe +-- setFdOption w CloseOnExec True +-- h <- fdToHandle w +-- -- ASSUME we are using utf8 everywhere +-- hSetEncoding h utf8 +-- hSetBuffering h LineBuffering +-- return (r, h) +-- child r = void $ withRunInIO $ \runIO -> do +-- X.xfork $ runIO $ do +-- void $ liftIO $ dupTo r stdInput +-- liftIO $ executeFile "/bin/sh" False ["-c", T.unpack x] Nothing -- | Run 'XMonad.Core.spawn' with a command and arguments spawnCmd :: MonadIO m => FilePath -> [T.Text] -> m ()