message: Allow running ExecuteGettext* on non-main thread
  wxExecute only works from the main thread. Direct any calls from worker
  threads to the main one for the duration of the wxExecute call.
diff: #include <wx/utils.h>
  #include <wx/log.h>
  #include <wx/process.h>
  +#include <wx/thread.h>
  #include <wx/txtstrm.h>
  #include <wx/string.h>
  #include <wx/intl.h>
  #include <regex>
  #include <boost/throw_exception.hpp>
  +#include "concurrency.h"
  #include "gexecute.h"
  #include "errors.h"
  @@ -112,8 +114,9 @@ bool ReadOutput(wxInputStream& s, wxArrayString& out)
  return true;
  }
  -long DoExecuteGettext(const wxString& cmdline_, wxArrayString& gstderr)
  +std::pair<long, wxArrayString> DoExecuteGettextImpl(const wxString& cmdline_)
  {
  + wxArrayString gstderr;
  wxExecuteEnv env;
  wxString cmdline(cmdline_);
  @@ -148,7 +151,23 @@ long DoExecuteGettext(const wxString& cmdline_, wxArrayString& gstderr)
  BOOST_THROW_EXCEPTION(Exception(wxString::Format(_("Cannot execute program: %s"), cmdline.c_str())));
  }
  - return retcode;
  + return std::make_pair(retcode, gstderr);
  +}
  +
  +std::pair<long, wxArrayString> DoExecuteGettext(const wxString& cmdline)
  +{
  +#if wxUSE_GUI
  + if (wxThread::IsMain())
  + {
  + return DoExecuteGettextImpl(cmdline);
  + }
  + else
  + {
  + return dispatch::on_main([=]{ return DoExecuteGettextImpl(cmdline); }).get();
  + }
  +#else
  + return DoExecuteGettextImpl(cmdline);
  +#endif
  }
  void LogUnrecognizedError(const wxString& err)
  @@ -173,7 +192,8 @@ void LogUnrecognizedError(const wxString& err)
  bool ExecuteGettext(const wxString& cmdline)
  {
  wxArrayString gstderr;
  - long retcode = DoExecuteGettext(cmdline, gstderr);
  + long retcode;
  + std::tie(retcode, gstderr) = DoExecuteGettext(cmdline);
  wxString pending;
  for (auto& ln: gstderr)
  @@ -205,7 +225,8 @@ bool ExecuteGettext(const wxString& cmdline)
  bool ExecuteGettextAndParseOutput(const wxString& cmdline, GettextErrors& errors)
  {
  wxArrayString gstderr;
  - long retcode = DoExecuteGettext(cmdline, gstderr);
  + long retcode;
  + std::tie(retcode, gstderr) = DoExecuteGettext(cmdline);
  static const std::wregex RE_ERROR(L".*\\.po:([0-9]+)(:[0-9]+)?: (.*)");
  