From 66550a08a6a2a32b41f6d6c27482a6e61f5ddb97 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Mon, 2 Jan 2023 21:01:12 -0500 Subject: [PATCH] WIP try dup-ing stderr from parent process --- lib/XMonad/Internal/Shell.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/XMonad/Internal/Shell.hs b/lib/XMonad/Internal/Shell.hs index 88566e7..d59adc9 100644 --- a/lib/XMonad/Internal/Shell.hs +++ b/lib/XMonad/Internal/Shell.hs @@ -98,20 +98,19 @@ spawnPipe = liftIO . spawnPipeRW spawnPipeRW :: T.Text -> IO Handle spawnPipeRW x = do (rI, wI) <- createPipe - (rO, wO) <- createPipe + -- (rO, wO) <- createPipe -- 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 -- 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 void $ X.xfork $ do void $ dupTo rI stdInput - void $ dupTo wO stdOutput - void $ dupTo wO stdError + void $ dupTo err stdOutput + void $ dupTo err stdError executeFile "/bin/sh" False ["-c", T.unpack x] Nothing - void $ dupTo stdError rO closeFd rI - closeFd wO return h where mkHandle fd = do