[gambit-list] How to do pipe?

Lam Luu luuxuanlam at gmail.com
Tue Jun 16 14:48:12 EDT 2009


On 06/16/2009 11:03 AM, Marc Feeley wrote:
>
> On 14-Jun-09, at 1:09 PM, Marc Feeley wrote:
>
>> On 14-Jun-09, at 10:59 AM, Lam Luu wrote:
>>
>>> Hello all,
>>>
>>> Is there anyway to open a pipe to a new process (On Unix)? You know,
>>> like popen in C. I have searched through the manual, but could not
>>> find
>>> anything there.
>>
>> Look for "open-process" in the manual.  If your Gambit is properly
>> installed, just do (help open-process).
>>
>> Here is a simple example on Unix:
>>
>>> (read-line (open-process "date"))
>> "Sun Jun 14 13:07:57 EDT 2009"
>
> Although this works it is not usable in general because the process 
> may not be reclaimed properly.
>
> The latest patch to Gambit solves this problem by introducing new 
> procedures: call-with-input-proces, with-input-from-process, etc.  
> These procedures wait for the process to terminate (by calling process 
> status).  The patch also fixes a bug in process-status.  So the 
> example can be rewritten:
>
> > (with-input-from-process "date" read-line)
> "Tue Jun 16 12:02:21 EDT 2009"
>
> Marc
>
So, for now, what can I do?

Thank you,
Lam Luu


More information about the Gambit-list mailing list