Example #1
0
QString QProcessProto::workingDirectory() const
{
  QProcess *item = qscriptvalue_cast<QProcess*>(thisObject());
  if (item)
    return item->workingDirectory();
  return QString();
}
// Run a build process with merged stdout/stderr and qWarn about errors.
static bool runBuildProcess(QProcess &proc,
                            const FileName &binary,
                            const QStringList &args,
                            int timeoutS,
                            bool ignoreNonNullExitCode,
                            QString *output, QString *errorMessage)
{
    const bool rc = runBuildProcessI(proc, binary, args, timeoutS, ignoreNonNullExitCode, output, errorMessage);
    if (!rc) {
        // Fail - reformat error.
        QString cmd = binary.toString();
        if (!args.isEmpty()) {
            cmd += QLatin1Char(' ');
            cmd += args.join(QLatin1Char(' '));
        }
        *errorMessage =
                QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
                                            "Error running \"%1\" in %2: %3").
                                            arg(cmd, proc.workingDirectory(), *errorMessage);
        qWarning("%s", qPrintable(*errorMessage));
    }
    return rc;
}
Example #3
0
// int VSslServer::ssl_servername_cb_debug(SSL *con, int *ad, void *arg, int* debug) // gilgil temp 2014.03.14
int VSslServer::ssl_servername_cb(SSL *con, int *ad, void *arg)
{
  Q_UNUSED(ad)

  const char* serverName = SSL_get_servername(con, TLSEXT_NAMETYPE_host_name);
  // *debug = 1000; // gilgil temp 2014.03.14

  if (serverName == NULL)
  {
    LOG_DEBUG("serverName is null");
    return SSL_TLSEXT_ERR_NOACK;
  }
  // *debug = 2500; // gilgil temp 2014.03.14
  // LOG_DEBUG("serverName=%p %s", serverName, serverName); // gilgil temp 2014.03.14
  // *debug = 3000; // gilgil temp 2014.03.14

  VSslServer* server  = (VSslServer*)(arg);
  LOG_ASSERT(server != NULL);

  VSslServerSession* session = (VSslServerSession*)SSL_get_ex_data(con, VSslSession::VSSL_SESSION_IDENTIFY_INDEX);
  LOG_ASSERT(session->con == con);

  // *debug = 500; // gilgil temp 2014.03.14
  // LOG_DEBUG("server=%p session=%p", server, session); // gilgil temp 2014.03.14

  QString path = server->certificatePath;
  QFileInfo fi(path);
  if (!fi.isAbsolute())
  {
    // path = VApp::_filePath() + path; // gilgil temp 2014.12.25
    path = QCoreApplication::applicationDirPath() + QDir::separator() + path;
  }
  if (!path.endsWith('/') && !path.endsWith('\\')) path += QDir::separator();

  QString fileName = path + serverName + ".pem";
  // *debug = 4000; // gilgil temp 2014.03.14
  {
    VLock lock(server->certificateCs); // protect file create critical section
    // *debug = 5000; // gilgil temp 2014.03.14
    if (!QFile::exists(fileName))
    {
      QProcess process;

      process.setWorkingDirectory(path);
      LOG_DEBUG("working directory=%s", qPrintable(process.workingDirectory())); // gilgil temp 2014.03.01

      QString command = QString("\"%1_make_site.bat\" %2 2>&1").arg(path).arg(serverName);
      LOG_INFO("command=%s", qPrintable(command));

      process.start(command);
      // LOG_DEBUG("pid=%llx", process.pid()); // gilgil temp 2015.01.02

      // *debug = 6000; // gilgil temp 2014.03.14
      if(!process.waitForStarted())
      {
        LOG_FATAL("process.waitForStarted(%s) return false", qPrintable(command));
      }
      // *debug = 700; // gilgil temp 2014.03.14
      while(process.waitForReadyRead())
      {
        QByteArray ba = process.readAll();
        LOG_DEBUG("ba.size=%d", ba.size())
        LOG_DEBUG("ba.datas=%s", ba.data());
      }
      // *debug = 8000; // gilgil temp 2014.03.14
    }
    // *debug = 9000; // gilgil temp 2014.03.14
    // LOG_DEBUG("con=%p", con); // gilgil temp 2014.03.14
    // *debug = 9100; // gilgil temp 2014.03.14
    if (!session->setup(fileName))
    {
      LOG_ERROR("session->setup(%s) return false", qPrintable(fileName));
    }
    // *debug = 9500; // gilgil temp 2014.03.14
  }

  return SSL_TLSEXT_ERR_NOACK;
}