[CWB] Error, again

Hardie, Andrew a.hardie at lancaster.ac.uk
Fri May 2 19:32:49 CEST 2008


Hi Ruprecht,

This will certainly work to suppress error messages, but wouldn't it be better to pick them up and get your PHP script to display them in some appropriate form?

EG if you are calling the program as a child process, you can open separate pipes from STDOUT and STDERR to PHP, and treat text from one and text from the other differently.

I use the following code (a translation into PHP of part of Stefan's Perl module):

		/* array of settings for the three pipe-handles */
		$io_settings = array(
			IN  => array("pipe", "r"), /* pipe allocated to child's stdin  */
			OUT => array("pipe", "w"), /* pipe allocated to child's stdout */
			ERR => array("pipe", "w")  /* pipe allocated to child's stderr */
			);

		/* start the child process */
		$command = PATH_TO_CWB . "cqp -c";

		$process = proc_open($command, $io_settings, $handle);

		if (! is_resource($this->process))
			exit("ERROR: CQP backend startup failed; command ==\n$command\n");

Running CQP as a child process with proc_open() gives you much more flexibility and control than just using exec(), e.g. you can keep the instance of CQP alive and send it multiple commands within the execution of the script, checking for either output or error messages after each command.

Best

Andrew.

Andrew Hardie
Department of Linguistics
Bowland College
Lancaster University
Lancaster LA1 4YT
United Kingdom
 
a.hardie at lancaster.ac.uk


-----Original Message-----
From: cwb-bounces at sslmit.unibo.it [mailto:cwb-bounces at sslmit.unibo.it] On Behalf Of Ruprecht von Waldenfels
Sent: 02 May 2008 18:21
To: cwb at sslmit.unibo.it
Subject: [CWB] Error, again


Dear all, 

I have solved it, sorry for disturbing:
one needs to redirect STDERR to /dev/null, as in

exec ("cqpcl ... 2> /dev/null");

Maybe somebody else will find this helpful...

Ruprecht

 
Ruprecht v. Waldenfels, M.A.
Institut für Slavistik, Universität Regensburg
Universitätsstr. 31, 93051 Regensburg
ruprecht dot waldenfels at sprachlit.uni-regensburg.de
skype: rvwaldenfels
Tel. +49 (0) 941 943 5319
Fax. +49 (0) 941 943 1991

_______________________________________________
CWB mailing list
CWB at sslmit.unibo.it
http://devel.sslmit.unibo.it/mailman/listinfo/cwb

Dear all,  

is there any easy way of surpressing CWB error messages? 
They seem to get piped to the web page directly (I control CWB from a php 
script).

Ruprecht


Ruprecht v. Waldenfels, M.A.
Institut für Slavistik, Universität Regensburg
Universitätsstr. 31, 93051 Regensburg
ruprecht dot waldenfels at sprachlit.uni-regensburg.de
skype: rvwaldenfels
Tel. +49 (0) 941 943 5319
Fax. +49 (0) 941 943 1991

_______________________________________________
CWB mailing list
CWB at sslmit.unibo.it
http://devel.sslmit.unibo.it/mailman/listinfo/cwb


More information about the CWB mailing list