WIP try dup-ing stderr from parent process
This commit is contained in:
parent
bfa7f40818
commit
66550a08a6
|
@ -98,20 +98,19 @@ spawnPipe = liftIO . spawnPipeRW
|
||||||
spawnPipeRW :: T.Text -> IO Handle
|
spawnPipeRW :: T.Text -> IO Handle
|
||||||
spawnPipeRW x = do
|
spawnPipeRW x = do
|
||||||
(rI, wI) <- createPipe
|
(rI, wI) <- createPipe
|
||||||
(rO, wO) <- createPipe
|
-- (rO, wO) <- createPipe
|
||||||
-- I'm assuming the only place this matters is when xmonad is restarted (which
|
-- I'm assuming the only place this matters is when xmonad is restarted (which
|
||||||
-- calls exec); since these are the ends of the pipe that xmonad will be
|
-- calls exec); since these are the ends of the pipe that xmonad will be
|
||||||
-- using, this ensures they will be closed when restarting
|
-- using, this ensures they will be closed when restarting
|
||||||
forM_ [wI, rO] $ \fd -> setFdOption fd CloseOnExec True
|
err <- dup stdError
|
||||||
|
forM_ [wI, err] $ \fd -> setFdOption fd CloseOnExec True
|
||||||
h <- mkHandle wI
|
h <- mkHandle wI
|
||||||
void $ X.xfork $ do
|
void $ X.xfork $ do
|
||||||
void $ dupTo rI stdInput
|
void $ dupTo rI stdInput
|
||||||
void $ dupTo wO stdOutput
|
void $ dupTo err stdOutput
|
||||||
void $ dupTo wO stdError
|
void $ dupTo err stdError
|
||||||
executeFile "/bin/sh" False ["-c", T.unpack x] Nothing
|
executeFile "/bin/sh" False ["-c", T.unpack x] Nothing
|
||||||
void $ dupTo stdError rO
|
|
||||||
closeFd rI
|
closeFd rI
|
||||||
closeFd wO
|
|
||||||
return h
|
return h
|
||||||
where
|
where
|
||||||
mkHandle fd = do
|
mkHandle fd = do
|
||||||
|
|
Loading…
Reference in New Issue