Small steps towards a pipestream... The current implementation of the LyXServer doesn't work well under Tru64 unix. The pipes are opened and closed continually because LyXComm::read_ready() is called from the GUI callback routine on every cycle until the pipe first receives some input.
Ie, with the patch below I get console output: LyXComm: Receiving from fd 6 LyXComm: Receiving from fd 6 LyXComm: Receiving from fd 6 LyXComm: Receiving from fd 6 [snip...] LyXComm: Receiving from fd 6 LyXComm: Receiving from fd 6 LyXComm: Receiving from fd 6 LyXComm: Receiving from fd 6 LyXComm: Receiving from fd 6 LyXComm: status:19, lsbuf:, cmd:LYXSRV:angus:hello LyXServer: Received: 'LYXSRV:angus:hello' LyXServer: Client: 'angus' Command: 'hello' Argument: '' LyXServer: Greeting angus LyXComm: Sending 'LYXSRV:angus:hello' Thereafter, all behaves "normally". Ie, input to LyXComm::read_ready() is received only when something is passed to the pipe. Clearly, therefore, the real "problem" lies in the xforms routine fl_add_io_callback(), or rather in fl_watch_io() that does the actual polling. Jean-Marc has noted that pipes under Tru64 unix have slightly different semantics to those under Linux. I guess that this is the net result. Nonetheless, the following patch to LyXComm::read_ready() fixes the symptoms (pipes opened and closed continually), makes the code clearer and certainly does no harm. It does no more than move closeConnection(); openConnection(); inside the if-error block where it really belongs. Ok to apply? Angus Index: lyxserver.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxserver.C,v retrieving revision 1.45 diff -u -p -r1.45 lyxserver.C --- lyxserver.C 14 Aug 2002 21:22:29 -0000 1.45 +++ lyxserver.C 2 Sep 2002 13:55:23 -0000 @@ -290,23 +286,26 @@ void LyXComm::read_ready() //\n or not \n? } } + if (rerrno == EAGAIN) { - errno = 0; - return; - } - if (rerrno != 0) { + break; + + } else if (rerrno != 0) { lyxerr << "LyXComm: " << strerror(rerrno) << endl; if (!lsbuf.empty()) { lyxerr << "LyXComm: truncated command: " << lsbuf << endl; lsbuf.erase(); } - break; // reset connection + + // reset connection + closeConnection(); + openConnection(); + break; } } - closeConnection(); - openConnection(); - errno= 0; + + errno = 0; }