diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-08-30 00:48:59 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-15 16:14:19 +0200 |
commit | 3d8802e235e9508a0bf3d8a1168ad11c95571579 (patch) | |
tree | 6472bbd934dea6081b5a5ab1464989d4f8cec8df | |
parent | 6b09016f5d9119729265211db6cc91f991fc3e28 (diff) | |
download | sink-3d8802e235e9508a0bf3d8a1168ad11c95571579.tar.gz sink-3d8802e235e9508a0bf3d8a1168ad11c95571579.zip |
Also call commandFinished in the error case.
-rw-r--r-- | sinksh/state.cpp | 4 | ||||
-rw-r--r-- | sinksh/syntax_modules/sink_sync.cpp | 8 |
2 files changed, 10 insertions, 2 deletions
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 @@ | |||
26 | 26 | ||
27 | #include "common/log.h" | 27 | #include "common/log.h" |
28 | 28 | ||
29 | SINK_DEBUG_AREA("state") | ||
30 | |||
29 | static bool s_hasEventLoop = false; | 31 | static bool s_hasEventLoop = false; |
30 | 32 | ||
31 | class State::Private | 33 | class State::Private |
@@ -127,6 +129,7 @@ unsigned int State::debugLevel() const | |||
127 | 129 | ||
128 | int State::commandStarted() const | 130 | int State::commandStarted() const |
129 | { | 131 | { |
132 | SinkTrace() << "Command started"; | ||
130 | if (!s_hasEventLoop) { | 133 | if (!s_hasEventLoop) { |
131 | return QCoreApplication::exec(); | 134 | return QCoreApplication::exec(); |
132 | } else if (!d->eventLoop()->isRunning()) { | 135 | } else if (!d->eventLoop()->isRunning()) { |
@@ -138,6 +141,7 @@ int State::commandStarted() const | |||
138 | 141 | ||
139 | void State::commandFinished(int returnCode) const | 142 | void State::commandFinished(int returnCode) const |
140 | { | 143 | { |
144 | SinkTrace() << "Command finished"; | ||
141 | if (!s_hasEventLoop) { | 145 | if (!s_hasEventLoop) { |
142 | QCoreApplication::exit(returnCode); | 146 | QCoreApplication::exit(returnCode); |
143 | } else { | 147 | } 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) | |||
45 | } | 45 | } |
46 | 46 | ||
47 | QTimer::singleShot(0, [query, state]() { | 47 | QTimer::singleShot(0, [query, state]() { |
48 | Sink::Store::synchronize(query).syncThen<void>([state]() { | 48 | Sink::Store::synchronize(query).syncThen<void>([state](const KAsync::Error &error) { |
49 | state.printLine("Synchronization complete!"); | 49 | if (error) { |
50 | state.printLine("Synchronization failed!"); | ||
51 | } else { | ||
52 | state.printLine("Synchronization complete!"); | ||
53 | } | ||
50 | state.commandFinished(); | 54 | state.commandFinished(); |
51 | }).exec(); | 55 | }).exec(); |
52 | }); | 56 | }); |