diff options
author | Zhu, Yongsheng <yongsheng.zhu@intel.com> | 2010-04-14 16:38:05 +0800 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2010-04-14 10:46:35 +0200 |
commit | 4cd3a2f913221581bae5ba2f7f11ee9e1081e67e (patch) | |
tree | 22f7cb2bc532d82e71e838bfcb3fa9cf95b4c5e9 | |
parent | 3da3a388cc8fcb85338035482adf55f787aefdb0 (diff) |
dbus server + command line: return error code (MB#10476)mb10476
If there is any error during executing command line arguments in
dbus server, it should catch the exception and set the error code
in the Status. Thus command line can judge the error code and
return the correct value to system.
-rw-r--r-- | src/syncevo-dbus-server.cpp | 12 | ||||
-rw-r--r-- | src/syncevolution.cpp | 6 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/syncevo-dbus-server.cpp b/src/syncevo-dbus-server.cpp index 335796e4..da7302c9 100644 --- a/src/syncevo-dbus-server.cpp +++ b/src/syncevo-dbus-server.cpp @@ -2014,7 +2014,8 @@ public: try { m_cmdline.run(); } catch (...) { - Exception::handle(); + redirectPtr->flush(); + throw; } // always forward all currently pending redirected output // before closing the session @@ -3327,7 +3328,14 @@ void Session::run() m_restoreBefore ? SyncContext::DATABASE_BEFORE_SYNC : SyncContext::DATABASE_AFTER_SYNC); break; case OP_CMDLINE: - m_cmdline->run(); + try { + m_cmdline->run(); + } catch (...) { + SyncMLStatus status = Exception::handle(); + if (!m_error) { + m_error = status; + } + } default: break; }; diff --git a/src/syncevolution.cpp b/src/syncevolution.cpp index c4730caa..f5c62c76 100644 --- a/src/syncevolution.cpp +++ b/src/syncevolution.cpp @@ -1023,6 +1023,12 @@ void RemoteSession::statusChangedCb(const string &status, const SourceStatuses_t &sourceStatus) { m_status = status; + + if (errorCode) { + m_server.setResult(false); + g_main_loop_quit(m_server.getLoop()); + } + if(status == "done") { //if session is done, quit the loop g_main_loop_quit(m_server.getLoop()); |