darcs patch: make spawn redirect std* to /dev/null

Sun Sep 23 15:13:40 CEST 2007 l.mai@web.de * make spawn redirect std* to /dev/null spawn'd programs inherit their std{in,out,err} from xmonad. This can interfere with logHook logging because some programs dump debugging output to stdout or stderr. This patch therefore redirects all standard streams to /dev/null when a new program is started.

On Sun, Sep 23, 2007 at 03:19:37PM +0200, l.mai@web.de wrote:
Sun Sep 23 15:13:40 CEST 2007 l.mai@web.de * make spawn redirect std* to /dev/null
spawn'd programs inherit their std{in,out,err} from xmonad. This can interfere with logHook logging because some programs dump debugging output to stdout or stderr. This patch therefore redirects all standard streams to /dev/null when a new program is started.
I'd prefer that this patch didn't go in. I'd rather be able to debug what goes wrong when a spawned process doesn't work right. At least stderr should be preserved. -- David Roundy Department of Physics Oregon State University

On Sep 23, 2007, at 15:16 , David Roundy wrote:
On Sun, Sep 23, 2007 at 03:19:37PM +0200, l.mai@web.de wrote:
Sun Sep 23 15:13:40 CEST 2007 l.mai@web.de * make spawn redirect std* to /dev/null
spawn'd programs inherit their std{in,out,err} from xmonad. This can interfere with logHook logging because some programs dump debugging output to stdout or stderr. This patch therefore redirects all standard streams to /dev/null when a new program is started.
I'd prefer that this patch didn't go in. I'd rather be able to debug what goes wrong when a spawned process doesn't work right. At least stderr should be preserved.
I was thinking it would be nice to be able to specify a logfile for random program stdout/stderr. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

"Brandon S. Allbery KF8NH"
I was thinking it would be nice to be able to specify a logfile for random program stdout/stderr.
That would do. Would be cleaner, IMHO, for the logHook output to go somewhere else. Then in a normal setup you'd get the logging from clients in .xsession-errors, whether those started before xmonad or by xmonad.

xmonad:
"Brandon S. Allbery KF8NH"
writes: [...]
I was thinking it would be nice to be able to specify a logfile for random program stdout/stderr.
That would do. Would be cleaner, IMHO, for the logHook output to go somewhere else. Then in a normal setup you'd get the logging from clients in .xsession-errors, whether those started before xmonad or by xmonad.
Good idea! -- Don

Bruce Stephens
That would do. Would be cleaner, IMHO, for the logHook output to go somewhere else. Then in a normal setup you'd get the logging from clients in .xsession-errors, whether those started before xmonad or by xmonad.
I guess the simplest way would be to use the more conventional arrangement of xmonad starting the program (whether dzen2 or something else) that displays the information?

On Sun, Sep 23, 2007 at 08:33:45PM +0100, Bruce Stephens wrote:
Bruce Stephens
writes: [...]
That would do. Would be cleaner, IMHO, for the logHook output to go somewhere else. Then in a normal setup you'd get the logging from clients in .xsession-errors, whether those started before xmonad or by xmonad.
I guess the simplest way would be to use the more conventional arrangement of xmonad starting the program (whether dzen2 or something else) that displays the information?
It seems like that should be pretty easy to arrange... -- David Roundy Department of Physics Oregon State University

Bruce Stephens
Bruce Stephens
writes: [...]
That would do. Would be cleaner, IMHO, for the logHook output to go somewhere else. Then in a normal setup you'd get the logging from clients in .xsession-errors, whether those started before xmonad or by xmonad.
I guess the simplest way would be to use the more conventional arrangement of xmonad starting the program (whether dzen2 or something else) that displays the information?
Most of the programs by convention expect output from a sub-shell to also contain the output from the sub-shells within that sub-shell. Usually xdm or alike redirect those outputs from programs started by it and ~/.xsession and subsequent calls to ~/.xsession-errors. Normally, it's useless, but when something goes wrong, that is the first place to seek for insights. So I would think that redirecting the std{out,err} to /dev/null is bad. Since we can not force all other programs to make their own log files, the best way I believe is that to redirect the output of logHook. And I would suggest using FIFOs (named pipes) as a good solution for logHook to give its information to various displaying programs like dzen, xmobar or something similar. -- c/* __o/* <\ * (__ */\ <

On Sunday 23 September 2007 08:19:37 l.mai@web.de wrote:
Sun Sep 23 15:13:40 CEST 2007 l.mai@web.de * make spawn redirect std* to /dev/null
spawn'd programs inherit their std{in,out,err} from xmonad. This can interfere with logHook logging because some programs dump debugging output to stdout or stderr. This patch therefore redirects all standard streams to /dev/null when a new program is started.
The consensus seems to be that we should fix logHook rather than changing spawn. Cheers, Spencer Janssen

Spencer Janssen writes:
The consensus seems to be that we should fix logHook rather than changing spawn.
Attached is a module providing a log hook that starts its own dzen. This is very kludgy but shows that it can be achieved. Use it by putting in Config.hs: import XMonadContrib.StatusBar logHook = statusBar defaultSBConf This log hook includes window titles, but in order for them to be updated properly Main.hs need to be hacked to call logHook on XPropertyNotify events. I achieve this with: hunk ./Main.hs 254 -handle e = broadcastMessage e -- trace (eventName e) -- ignoring +handle e = do + case e of + (AnyEvent {ev_event_type = t}) + | t == propertyNotify -> updateProperties + _ -> return () + broadcastMessage e -- trace (eventName e) -- ignoring hunk ./Operations.hs 253 + +updateProperties :: X () +updateProperties = logHook I hope this is of some inspiration to others. Toby.
participants (8)
-
Brandon S. Allbery KF8NH
-
Bruce Stephens
-
David Roundy
-
Don Stewart
-
l.mai@web.de
-
Spencer Janssen
-
Toby Allsopp
-
Xiao-Yong Jin