| 1 | /*
|
|---|
| 2 | Copyright (C) 2012 - 2013 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| 3 |
|
|---|
| 4 | This library is free software; you can redistribute it and/or
|
|---|
| 5 | modify it under the terms of the GNU Lesser General Public
|
|---|
| 6 | License as published by the Free Software Foundation; either
|
|---|
| 7 | version 2.1 of the License, or (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This library is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 12 | Lesser General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU Lesser General Public
|
|---|
| 15 | License along with this library; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|---|
| 17 | MA 02110-1301 USA.
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 | #include "webserverrunner.h"
|
|---|
| 22 | #include "moc_webserverrunner.cpp"
|
|---|
| 23 |
|
|---|
| 24 | #include "sitestingconfig.h"
|
|---|
| 25 | #include "webserverprocess.h"
|
|---|
| 26 |
|
|---|
| 27 | #include <QProcess>
|
|---|
| 28 | #include <QDebug>
|
|---|
| 29 |
|
|---|
| 30 | WebserverRunner::WebserverRunner()
|
|---|
| 31 | : QObject()
|
|---|
| 32 | {
|
|---|
| 33 |
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | WebserverRunner::~WebserverRunner()
|
|---|
| 37 | {
|
|---|
| 38 |
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | void WebserverRunner::start()
|
|---|
| 42 | {
|
|---|
| 43 | QStringList arguments;
|
|---|
| 44 | arguments << QString("-S %1:%2").arg(QString(WEBSERVICE_SERVER_HOST)).arg(QString(WEBSERVICE_SERVER_PORT));
|
|---|
| 45 | arguments << QString("-t %1").arg(WebserverProcess::appendSlashToUrl(QString(WEBSERVICE_SERVER_DOCROOT)));
|
|---|
| 46 |
|
|---|
| 47 | qDebug() << QString("%1: Executing %2 %3").arg(metaObject()->className()).arg(QString(PHP_EXECUTABLE)).arg(arguments.join(" "));
|
|---|
| 48 | // _webserverProcess->setStandardInputFile("/tmp/test-input");
|
|---|
| 49 | // _webserverProcess->setStandardErrorFile("/tmp/test-error.log");
|
|---|
| 50 | // _webserverProcess->setStandardOutputFile("/tmp/test-output.log");
|
|---|
| 51 | // must be executed in own thread, QProcess::start isn't working
|
|---|
| 52 | QProcess::execute(QString(PHP_EXECUTABLE) +" "+ arguments.join(" "));
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|