From: Olivier Goffart Date: Fri, 31 Mar 2017 09:13:18 +0000 (+0200) Subject: owncloudcmd: return code depend on sync result X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~722^2~44 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4af45394f9f61fbc68c9f0a4d2e5387d14052e3b;p=nextcloud-desktop.git owncloudcmd: return code depend on sync result Issue #3936 --- diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp index d4a9fc581..5421b2314 100644 --- a/src/cmd/cmd.cpp +++ b/src/cmd/cmd.cpp @@ -478,7 +478,12 @@ restart_sync: SyncEngine engine(account, options.source_dir, folder, &db); engine.setIgnoreHiddenFiles(options.ignoreHiddenFiles); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QObject::connect(&engine, &SyncEngine::finished, + [&app](bool result) { app.exit(result ? EXIT_SUCCESS : EXIT_FAILURE); }); +#else QObject::connect(&engine, SIGNAL(finished(bool)), &app, SLOT(quit())); +#endif QObject::connect(&engine, SIGNAL(transmissionProgress(ProgressInfo)), &cmd, SLOT(transmissionProgressSlot())); @@ -505,7 +510,7 @@ restart_sync: // Have to be done async, else, an error before exec() does not terminate the event loop. QMetaObject::invokeMethod(&engine, "startSync", Qt::QueuedConnection); - app.exec(); + int resultCode = app.exec(); if (engine.isAnotherSyncNeeded() != NoFollowUpSync) { if (restartCount < options.restartTimes) { @@ -516,6 +521,6 @@ restart_sync: qWarning() << "Another sync is needed, but not done because restart count is exceeded" << restartCount; } - return 0; + return resultCode; }