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...

>> 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.

> 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:

#!/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}"
}

-- 
Angus

Reply via email to