//Result from popup application is available. Read it.
DPL::BinaryQueueAutoPtr resultData =
m_input.Read(std::numeric_limits<std::size_t>::max());
- const int result = PopupSerializer::getIntArg(*resultData);
+ const int success = PopupSerializer::getIntArg(*resultData);
+ bool retVal = false;
+ if (success) {
+ const int result = PopupSerializer::getIntArg(*resultData);
- LogDebug("Popup result is: " << result);
+ LogDebug("Popup result is: " << result);
- Assert(resultData->Empty());
+ Assert(resultData->Empty());
+ retVal = (!!result);
+ } else {
+ LogWarning("Failed to show popup.");
+ }
tmp.Close();
m_input.Close();
m_output.Close();
- return (!!result);
+ return retVal;
}
Catch(DPL::Exception)
{
m_output.Write(data, data.Size());
executePopup();
-
+ DPL::BinaryQueueAutoPtr resultData =
+ m_input.Read(std::numeric_limits<std::size_t>::max());
+ const int success = PopupSerializer::getIntArg(*resultData);
+ if (!success) {
+ LogWarning("Failed to show popup.");
+ }
//ignore result
tmp.Close();
//Result from popup application is available. Read it.
DPL::BinaryQueueAutoPtr resultData =
m_input.Read(std::numeric_limits<std::size_t>::max());
- const int result = PopupSerializer::getIntArg(*resultData);
- const int rememberResult = PopupSerializer::getIntArg(*resultData);
-
- LogDebug(
- "Popup result is: " << result << " remeber: " << rememberResult);
-
- Assert(resultData->Empty());
- tmp.Close();
- m_input.Close();
- m_output.Close();
-
- if (1 == result) {
- if (rememberResult == 1) {
- return YES_DO_REMEMBER;
+ const int success = PopupSerializer::getIntArg(*resultData);
+ if (success) {
+ const int result = PopupSerializer::getIntArg(*resultData);
+ const int rememberResult = PopupSerializer::getIntArg(*resultData);
+
+ LogDebug(
+ "Popup result is: " << result << " remeber: " << rememberResult);
+
+ Assert(resultData->Empty());
+ tmp.Close();
+ m_input.Close();
+ m_output.Close();
+
+ if (1 == result) {
+ if (rememberResult == 1) {
+ return YES_DO_REMEMBER;
+ } else {
+ return YES_DONT_REMEMBER;
+ }
} else {
- return YES_DONT_REMEMBER;
+ if (rememberResult == 1) {
+ return NO_DO_REMEMBER;
+ } else {
+ return NO_DONT_REMEMBER;
+ }
}
} else {
- if (rememberResult == 1) {
- return NO_DO_REMEMBER;
- } else {
- return NO_DONT_REMEMBER;
- }
+ LogWarning("Popup failed to execute.");
+ tmp.Close();
+ m_input.Close();
+ m_output.Close();
+ return NO_DONT_REMEMBER;
}
}
Catch(DPL::Exception)
pid_t pid = fork();
if (pid == -1) {
//error occured
- LogError("Cannot display popup!");
+ LogError("Failed to create popup process.");
Assert(false);
}
if (pid == 0) {
NULL);
if (ret == -1) {
//execl returns -1 on error
- LogError("Cannot display popup!");
+ LogError("Failed to set popup binary");
+ //write something to pipe to unblock caller process
+ DPL::NamedOutputPipe errOut;
+ errOut.Open(m_inputName);
+ DPL::BinaryQueue data;
+ PopupSerializer::appendArg(false, data);
+ errOut.Write(data, data.Size());
+ errOut.Close();
+
Assert(false);
}
}