diff -u xdg-mime.in xdg-mime.in --- xdg-mime.in +++ xdg-mime.in @@ -157,11 +157,28 @@ exit_success } +ktradertest_fixup() +{ + # ktradertest might fork off a copy of kdeinit if one does not already + # exist. It will exit after about 15 seconds if no further processes need it + # around. But since it may not close its stdout, the shell (via grep) could + # end up waiting around for kdeinit to exit. If we start a copy here, that + # copy will be used instead and we will avoid waiting. + if [ -z "$ktradertest_fixed" ]; then + # Pick any old MIME type; we don't care about the results. + DEBUG 2 "Running dummy ktradertest \"text/plain\" Application" + ktradertest text/plain Application > /dev/null 2>&1 + # Only do this once, as we only need it once. + ktradertest_fixed=yes + fi +} + defapp_kde() { MIME="$1" ktradertest=`which ktradertest 2> /dev/null` if [ -n "$ktradertest" ] ; then + ktradertest_fixup DEBUG 1 "Running ktradertest \"$MIME\" Application" trader_result=`ktradertest "$MIME" Application 2>/dev/null | grep DesktopEntryPath \ | head -n 1 | cut -d ':' -f 2 | cut -d \' -f 2`