Version: (using KDE 4.2.2) OS: Linux Installed from: Ubuntu Packages ktradertest, designed to be used from shell scripts, starts kdeinit (with --suicide --new-startup) if it does not find one running already. However kdeinit does not then close its standard input and output, so if ktradertest is piped into, say, grep by the shell script, then grep will not exit until kdeinit also exits. kdeinit waits about 15 seconds before exiting in case there are any other clients that want to use it, so the shell script waits around for grep which is waiting for kdeinit. This makes ktradertest useless for its intended purpose! I'm not sure whether kdeinit, ktradertest, or perhaps some library used by ktradertest to start kdeinit should truly be responsible for closing stdin/stdout in this scenario, but it should happen somewhere to fix this problem. We ran into this problem with Chromium's default browser detection, which uses xdg-mime which uses ktradertest piped into grep. See http://code.google.com/p/chromium/issues/detail?id=17179 for reference.
ktradertest itself is a KDE 3 utility which did not make the transition to KDE 4 (I presume due to us using shared-mime-info now). The underlying kdeinit issue itself may still be a problem for other similar uses but I would think we don't want to just close stdin/stdout since the children processes which make up KDE would all be unable to send output to or receive output from a tty. Perhaps the best route is to have kdeinit close stdin/stdout if it's not going to/from a tty?
ktradertest from KDE 3 can be found as ktraderclient in kdebase/runtime on KDE 4.
SVN commit 1100408 by ossi: redirect stdout to stderr if we are forked from a command line tool (say, ktraderclient) which is used in a pipe, us keeping open the inherited stdout is pretty fatal for the usefulness of the pipe. as we have no use for a real stdout (if any at all), just redirect it to stderr. we can't just close/redirect stderr, as this is where all "interesting" output is going. so if somebody tries to use some tool's stderr in a pipe, he'd still be out of luck. BUG: 201714 M +4 -0 kinit.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1100408