[plt-scheme] external processes

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


I have a console based program which accepts data on its
input and depending on that data it performs some operation.
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/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
executing program through checking the status of the process,
but in this thread how can I wait for the process, without
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
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

- 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
I can provide an example. Although I have tried to minimise
the code is still a bit long, but I would be happy to send
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! 

Posted on the users mailing list.