Reorganize the code a bit and Disable QProcess evaluation for now as nothing works...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29626 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2009-05-11 09:01:44 +00:00
parent dc267d6dd9
commit 416a6cd1c0

View File

@ -22,6 +22,8 @@
#include <QProcess> #include <QProcess>
#define DISABLE_EVALUATE_QPROCESS
using namespace std; using namespace std;
namespace lyx { namespace lyx {
@ -30,6 +32,7 @@ namespace support {
// Reuse of instance // Reuse of instance
int Systemcall::startscript(Starttype how, string const & what) int Systemcall::startscript(Starttype how, string const & what)
{ {
#ifdef DISABLE_EVALUATE_QPROCESS
string command = what; string command = what;
if (how == DontWait) { if (how == DontWait) {
@ -43,36 +46,39 @@ int Systemcall::startscript(Starttype how, string const & what)
} }
} }
//#define DISABLE_EVALUATE_QPROCESS return ::system(command.c_str());
#ifndef DISABLE_EVALUATE_QPROCESS #else
QString cmd = QString::fromLocal8Bit(command.c_str()); QString cmd = QString::fromLocal8Bit(what.c_str());
QProcess process; QProcess * process = new QProcess;
process.start(cmd); process->start(cmd);
if (!process.waitForStarted(1000)) { if (!process->waitForStarted(1000)) {
LYXERR0("Qprocess " << cmd << " did not start!"); LYXERR0("Qprocess " << cmd << " did not start!");
LYXERR0("error " << process.error()); LYXERR0("error " << process->error());
LYXERR0("state " << process.state()); LYXERR0("state " << process->state());
LYXERR0("status " << process.exitStatus()); LYXERR0("status " << process->exitStatus());
return 10; return 10;
} }
if (!process.waitForFinished(30000)) { if (how == DontWait)
return 0;
if (!process->waitForFinished(30000)) {
LYXERR0("Qprocess " << cmd << " did not finished!"); LYXERR0("Qprocess " << cmd << " did not finished!");
LYXERR0("error " << process.error()); LYXERR0("error " << process->error());
LYXERR0("state " << process.state()); LYXERR0("state " << process->state());
LYXERR0("status " << process.exitStatus()); LYXERR0("status " << process->exitStatus());
return 20; return 20;
} }
if (process.exitCode()) { int const exit_code = process->exitCode();
if (exit_code) {
LYXERR0("Qprocess " << cmd << " finished!"); LYXERR0("Qprocess " << cmd << " finished!");
LYXERR0("exitCode " << process.exitCode()); LYXERR0("exitCode " << process->exitCode());
LYXERR0("error " << process.error()); LYXERR0("error " << process->error());
LYXERR0("state " << process.state()); LYXERR0("state " << process->state());
LYXERR0("status " << process.exitStatus()); LYXERR0("status " << process->exitStatus());
} }
return process.exitCode(); delete process;
return exit_code;
#endif #endif
return ::system(command.c_str());
} }
} // namespace support } // namespace support