[plasma-framework] src/shell: [plasma-shell] Add an option to suppress any output (--shut-up)

Àlex Fiestas afiestas at kde.org
Tue Dec 17 18:49:20 UTC 2013


Git commit c047dd5f686c5850fdb2638854885bd76151ef93 by Àlex Fiestas.
Committed on 17/12/2013 at 18:33.
Pushed by afiestas into branch 'master'.

[plasma-shell] Add an option to suppress any output (--shut-up)

The amount of warnings that plasma-shell has, makes it super hard to
make use of tools like journalctl or to grep ~/.xsession-errors.

We need these tools to diagnose possible bugs in the session start or
any other software that redirects stderr or those places.

We can remove this option once all the Warnings are fixed, specially
the one in Qt: https://codereview.qt-project.org/#change,73943

CCMAIL: plasma-devel at kde.org

M  +12   -0    src/shell/main.cpp

http://commits.kde.org/plasma-framework/c047dd5f686c5850fdb2638854885bd76151ef93

diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index f6c797d..e073d00 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -32,6 +32,11 @@ static const char description[] = "Plasma Shell";
 static const char version[] = "2.0";
 static QCommandLineParser parser;
 
+void noMessageOutput(QtMsgType type, const char *msg)
+{
+     Q_UNUSED(type);
+     Q_UNUSED(msg);
+}
 int main(int argc, char** argv)
 {
     QApplication app(argc, argv);
@@ -54,11 +59,15 @@ int main(int argc, char** argv)
                                      QStringLiteral("Recent number of crashes"),
                                      QStringLiteral("n"));
 
+    QCommandLineOption shutup(QStringList() << QStringLiteral("s") << QStringLiteral("shut-up"),
+                                     QStringLiteral("Shuts up the output"));
+
     parser.addVersionOption();
     parser.addHelpOption();
     parser.addOption(dbg);
     parser.addOption(win);
     parser.addOption(crash);
+    parser.addOption(shutup);
 
     parser.process(app);
 
@@ -68,6 +77,9 @@ int main(int argc, char** argv)
         QQmlDebuggingEnabler enabler;
     }
 
+    if (parser.isSet(shutup)) {
+        qInstallMsgHandler(noMessageOutput);
+    }
     Plasma::PluginLoader::setPluginLoader(new ShellPluginLoader);
 
     ShellManager::setCrashCount(parser.value(crash).toInt());



More information about the Plasma-devel mailing list