[rkward-cvs] SF.net SVN: rkward: [1470] trunk/rkward/rkward/scriptbackends
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Feb 26 00:27:28 UTC 2007
Revision: 1470
http://svn.sourceforge.net/rkward/?rev=1470&view=rev
Author: tfry
Date: 2007-02-25 16:27:28 -0800 (Sun, 25 Feb 2007)
Log Message:
-----------
Better error handling in PHP backend
Modified Paths:
--------------
trunk/rkward/rkward/scriptbackends/common.php
trunk/rkward/rkward/scriptbackends/phpbackend.cpp
trunk/rkward/rkward/scriptbackends/phpbackend.h
Modified: trunk/rkward/rkward/scriptbackends/common.php
===================================================================
--- trunk/rkward/rkward/scriptbackends/common.php 2007-02-25 18:17:25 UTC (rev 1469)
+++ trunk/rkward/rkward/scriptbackends/common.php 2007-02-26 00:27:28 UTC (rev 1470)
@@ -32,6 +32,7 @@
}
ini_set ("error_prepend_string", "#RKEND#\nPHP-Error");
+ini_set ("error_append_string", "#RKQEND#\n");
while (1) {
eval (getInput ("requesting code"));
Modified: trunk/rkward/rkward/scriptbackends/phpbackend.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/phpbackend.cpp 2007-02-25 18:17:25 UTC (rev 1469)
+++ trunk/rkward/rkward/scriptbackends/phpbackend.cpp 2007-02-26 00:27:28 UTC (rev 1470)
@@ -60,6 +60,7 @@
//connect (php_process, SIGNAL (receivedStderr (KProcess *, char*, int)), this, SLOT (gotError (KProcess *, char*, int)));
connect (php_process, SIGNAL (wroteStdin (KProcess *)), this, SLOT (doneWriting (KProcess* )));
connect (php_process, SIGNAL (receivedStdout (KProcess *, char*, int)), this, SLOT (gotOutput (KProcess *, char*, int)));
+ connect (php_process, SIGNAL (processExited (KProcess *)), this, SLOT (processDied (KProcess*)));
if (!php_process->start (KProcess::NotifyOnExit, KProcess::All)) {
KMessageBox::error (0, i18n ("The PHP backend could not be started. Check whether you have correctly configured the location of the PHP-binary (Settings->Configure Settings->PHP backend)"), i18n ("PHP-Error"));
@@ -83,9 +84,9 @@
if (php_process) {
php_process->detach ();
+ php_process->deleteLater ();
+ php_process = 0;
}
- php_process->deleteLater ();
- php_process = 0;
busy_writing = false;
busy = false;
@@ -194,7 +195,7 @@
tryNextFunction ();
}
-void PHPBackend::gotOutput (KProcess *, char* buf, int len) {
+void PHPBackend::gotOutput (KProcess *, char* buf, int) {
RK_TRACE (PHP);
RK_DO (qDebug ("PHP transmission:\n%s", buf), PHP, DL_DEBUG);
@@ -297,9 +298,19 @@
destroy ();
return;
} else {
- RK_DO (qDebug ("unrecognized request from PHP backend: \"%s\"", request), PHP, DL_ERROR);
+ RK_DO (qDebug ("unrecognized request from PHP backend: \"%s\"", request.latin1()), PHP, DL_ERROR);
}
}
}
+void PHPBackend::processDied (KProcess *) {
+ RK_TRACE (PHP);
+
+ php_process->detach ();
+ KMessageBox::error (0, i18n ("The PHP-backend has died unexpectedly. The current output buffer is shown below:\n%1").arg (output_raw_buffer), i18n ("PHP Process exited"));
+ emit (haveError ());
+ destroy ();
+}
+
+
#include "phpbackend.moc"
Modified: trunk/rkward/rkward/scriptbackends/phpbackend.h
===================================================================
--- trunk/rkward/rkward/scriptbackends/phpbackend.h 2007-02-25 18:17:25 UTC (rev 1469)
+++ trunk/rkward/rkward/scriptbackends/phpbackend.h 2007-02-26 00:27:28 UTC (rev 1470)
@@ -52,6 +52,7 @@
public slots:
void gotOutput (KProcess *proc, char* buf, int len);
//void gotError (KProcess *proc, char* buf, int len);
+ void processDied (KProcess *proc);
void doneWriting (KProcess *proc);
private:
void tryNextFunction ();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list