Angus Leeming a écrit :
Abdelrazak Younes wrote:
We don't need something for process creation, we already have
src/support/forkedcall.[C,h].
Very good.

Unfortunately, it doesn't handle IPC through pipes connected to the
std{in,out,err} streams. I have code to do so in a platform independent
way, but it never got finished off. If you're interested...

The one thing that astonishes me is that boost has all kind of useful utilities (filesystems, thread, etc...) but apparently not that! What's the state of your code, does it provide something similar than QProcess? Is it an extension of "ForkedCall"?

Coming back to QProcess, I am sure we could use that in a clean manner by using a virtual base class that would be inherited by a new ForkedCall that would encapsulate QProcess. If rtti is enabled, the Lyx kernel could choose at runtime which ForkedCall class to use depending on the frontend. What do you think?

What would be needed is some sort of batch command processor that would
check the result of a command when it is finished and start the next
one. Not difficult in principle, but it probably takes some time to
implement this.

Really it should be able to handle pipes too... For now I'd suggest just
generating a python script to replace the dynamically-generated shell
script.

That would be a very nice short-term solution indeed. But I don't know python very well :-(

I have just read the header and it doesn't seem to have a method to
return the result. Does it create the process with two ways pipe?
The batch command processor logic should be the same as the one of the
on-the-fly script, shouldn't it? I am afraid I have some difficulty to
understand what those scripts do... that said I haven't tried very hard
;-)

Consider the case of conversion from format EPS to format PNG. The code in
GraphicsConverter.C generates a shell script to take care of all steps of
the process (there can be multiple conversions in principle). Here, "lyx
-dbg graphics" tells me that the following script is generated:

OK, thanks for the explanation. Basically, it's:
1) execute my_ps2png
        1-a) if returned != 0, remove outfile and  exit
        1-b) if outfile doen't exist verify that oufile.O exist and
             rename it to outfile if yes. Exit otherwise.
2) rename outfile from gconvert
        2-a) if "mv" command didn't succed try to "cp&&rm"

Am I correct? Is the above algorithm true for all conversion tools?

Abdel.



#!/bin/sh
infile='ICcrest.eps'
infile_base='ICcrest'
outfile='/tmp/lyx_tmpdir3105fYJQCw/gconvert03105XZkYgZ.png'

my_ps2png "${infile}" "${outfile}" ||
{
        'rm' -f "${outfile}"
        exit 1
}

if [ ! -f "${outfile}" ]; then
        if [ -f "${outfile}".0 ]; then
                'mv' -f "${outfile}".0 "${outfile}"
                'rm' -f "${outfile}".?
        else
                exit 1
        fi
fi

fromfile="${outfile}"
tofile='/tmp/lyx_tmpdir3105fYJQCw/ICcrest3105iaiTWK.png'

'mv' -f "${fromfile}" "${tofile}" ||
{
        'cp' -f "${fromfile}" "${tofile}" ||
        {
                exit 1
        }
        'rm' -f "${fromfile}"
}


Reply via email to