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