From 3d8802e235e9508a0bf3d8a1168ad11c95571579 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 30 Aug 2016 00:48:59 +0200 Subject: Also call commandFinished in the error case. --- sinksh/state.cpp | 4 ++++ sinksh/syntax_modules/sink_sync.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'sinksh') diff --git a/sinksh/state.cpp b/sinksh/state.cpp index 6fce21f..8f4a675 100644 --- a/sinksh/state.cpp +++ b/sinksh/state.cpp @@ -26,6 +26,8 @@ #include "common/log.h" +SINK_DEBUG_AREA("state") + static bool s_hasEventLoop = false; class State::Private @@ -127,6 +129,7 @@ unsigned int State::debugLevel() const int State::commandStarted() const { + SinkTrace() << "Command started"; if (!s_hasEventLoop) { return QCoreApplication::exec(); } else if (!d->eventLoop()->isRunning()) { @@ -138,6 +141,7 @@ int State::commandStarted() const void State::commandFinished(int returnCode) const { + SinkTrace() << "Command finished"; if (!s_hasEventLoop) { QCoreApplication::exit(returnCode); } else { diff --git a/sinksh/syntax_modules/sink_sync.cpp b/sinksh/syntax_modules/sink_sync.cpp index 2ed4cf7..e3c51ff 100644 --- a/sinksh/syntax_modules/sink_sync.cpp +++ b/sinksh/syntax_modules/sink_sync.cpp @@ -45,8 +45,12 @@ bool sync(const QStringList &args, State &state) } QTimer::singleShot(0, [query, state]() { - Sink::Store::synchronize(query).syncThen([state]() { - state.printLine("Synchronization complete!"); + Sink::Store::synchronize(query).syncThen([state](const KAsync::Error &error) { + if (error) { + state.printLine("Synchronization failed!"); + } else { + state.printLine("Synchronization complete!"); + } state.commandFinished(); }).exec(); }); -- cgit v1.2.3