void HgServeWrapper::startServer(const QString &repoLocation, int portNumber) { ServerProcessType *server = m_serverList.value(repoLocation, 0); if (server != 0) { m_serverList.remove(repoLocation); server->deleteLater(); } server = new ServerProcessType; m_serverList.insert(repoLocation, server); server->port = portNumber; server->process.setWorkingDirectory(HgWrapper::instance()->getBaseDir()); connect(&server->process, SIGNAL(started()), this, SIGNAL(started())); connect(&server->process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotFinished(int, QProcess::ExitStatus))); connect(server, SIGNAL(readyReadLine(const QString&, const QString&)), this, SIGNAL(readyReadLine(const QString&, const QString&))); QStringList args; args << QLatin1String("-oL"); args << QLatin1String("hg"); args << QLatin1String("serve"); args << QLatin1String("--port"); args << QString::number(portNumber); server->process.start(QLatin1String("stdbuf"), args); emit readyReadLine(repoLocation, i18n("## Starting Server ##")); emit readyReadLine(repoLocation, QString("% hg serve --port %1").arg(portNumber)); }
void QPxIODevice::splitInput() { #ifdef QPXIO_DEBUG qDebug("STA: QPxIODevice::splitInput()"); #endif int bi; qint64 ba; while ((ba = io->bytesAvailable())) { //while ((io->bytesAvailable())) { #ifdef QPXIO_DEBUG qDebug() << "IODevice bytes: " << ba; #endif /* #ifdef QPXIO_DEBUG if ( typeid(*io) == typeid(QTcpSocket) ) { // QByteArray tb; while ((io->bytesAvailable())) { buf+=io->read(1).replace(0,'\n'); } // buf+=QString(tb); // qDebug() << "ba.size(): " << tb.size(); // qDebug() << "buf: " << buf; } else { buf+=io->readAll(); } #else */ buf+=io->readAll().replace(0,'\n'); /* #endif */ while ((bi = buf.indexOf(QRegExp("[\n\r]"),0)) >=0 ) { if (bi>0) { lines << buf.left(bi); buf.remove(0,bi); } buf.remove(0,1); } // if (lines.size() > 4) emit readyReadLine(); } if (lines.size()) emit readyReadLine(); #ifdef QPXIO_DEBUG qDebug("END: QPxIODevice::splitInput()"); #endif }