]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
owncloudcmd: fix --silent
authorOlivier Goffart <ogoffart@woboq.com>
Thu, 22 Sep 2016 08:29:21 +0000 (10:29 +0200)
committerOlivier Goffart <ogoffart@woboq.com>
Thu, 22 Sep 2016 08:32:27 +0000 (10:32 +0200)
We ignored csync log, but we also need to silent Qt debug output.
We need to ignore it at the very begining because there might be
qDebug also in account creation.

Issue #5196

src/cmd/cmd.cpp

index d8f127dbe4874e8b6bab34f58d535a055e3fdda2..17a713735b8bf835fcd6e5cc3d9b0c5e24b701f0 100644 (file)
@@ -47,6 +47,9 @@
 
 using namespace OCC;
 
+
+static void nullMessageHandler(QtMsgType, const char *) {}
+
 struct CmdOptions {
     QString source_dir;
     QString target_url;
@@ -299,6 +302,11 @@ int main(int argc, char **argv) {
 
     parseOptions( app.arguments(), &options );
 
+    csync_set_log_level(options.silent ? 1 : 11);
+    if (options.silent) {
+        qInstallMsgHandler(nullMessageHandler);
+    }
+
     AccountPtr account = Account::create();
 
     if( !account ) {
@@ -415,7 +423,6 @@ int main(int argc, char **argv) {
     int restartCount = 0;
 restart_sync:
 
-    csync_set_log_level(options.silent ? 1 : 11);
 
     opts = &options;