REF make spawnPipe clearer
This commit is contained in:
parent
5b2c66033a
commit
f0451891b8
|
@ -101,10 +101,7 @@ spawnPipeRW
|
||||||
-> m Handle
|
-> m Handle
|
||||||
spawnPipeRW x = do
|
spawnPipeRW x = do
|
||||||
(r, h) <- liftIO mkPipe
|
(r, h) <- liftIO mkPipe
|
||||||
void $ withRunInIO $ \runIO -> do
|
child r
|
||||||
X.xfork $ runIO $ do
|
|
||||||
void $ liftIO $ dupTo r stdInput
|
|
||||||
liftIO $ executeFile "/bin/sh" False ["-c", T.unpack x] Nothing
|
|
||||||
liftIO $ closeFd r
|
liftIO $ closeFd r
|
||||||
return h
|
return h
|
||||||
where
|
where
|
||||||
|
@ -116,6 +113,10 @@ spawnPipeRW x = do
|
||||||
hSetEncoding h utf8
|
hSetEncoding h utf8
|
||||||
hSetBuffering h LineBuffering
|
hSetBuffering h LineBuffering
|
||||||
return (r, h)
|
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
|
-- | Run 'XMonad.Core.spawn' with a command and arguments
|
||||||
spawnCmd :: MonadIO m => FilePath -> [T.Text] -> m ()
|
spawnCmd :: MonadIO m => FilePath -> [T.Text] -> m ()
|
||||||
|
|
Loading…
Reference in New Issue