[plt-scheme] external processes

From: Ivanyi Peter (pivanyi at freemail.hu)
Date: Tue Mar 28 07:02:20 EST 2006

Hi,

I have a console based program which accepts data on its
standard 
input and depending on that data it performs some operation.
Now 
I would like to "drive" this program from a PLT GUI script. 
I have managed to do it, but with a couple of ugly hacks.
(I have tried these out only on a Windows XP machine.)

With regards to my scheme script I have the following problems:
- My biggest problem, that if I use one of the "process",
"process*", 
"process/port" and "process*/port" functions then no
interface is 
provided to check whether the underlying program has finished. 
I have tried to create a new thread which monitors the
currently 
executing program through checking the status of the process,
but in this thread how can I wait for the process, without
writing
a loop. (I have used "(sleep 1)" but that I do not like that.)

Then I have looked into the "process.scm" file and I could
see that 
the module uses the "subprocess" function for the above
mentioned
functions. So here are my questions:

  - Did I miss something and it is possible to wait for a
process that 
    I have started by one of the four "process" functions?

  - If it is not possible, can I propose a new function
which can have an
    extra argument, a finaliser function which is called
when the 
    process is finished/terminated?
    (No I have copied the code from "process.scm" and
modified it
    myself.)


- For some reason, and I do not understand why, after the
executed process is finished I cannot close its input port
immediately, for
example by the finaliser function. DrScheme will report that a 
read-char  function tries to read from an already closed port. 
Now who is reading from that port after the process has
finished?
I can provide an example. Although I have tried to minimise
everything
the code is still a bit long, but I would be happy to send
anybody 
who can help with it.


Thanks for any help.

Peter Ivanyi


_________________________________________________________________________
[origo] klikkbank lakossági számlacsomag havi 199 Ft-ért, bankkártya éves díj nélkül! 
www.klikkbank.hu




Posted on the users mailing list.