[gambit-list] with-output-to-process hangs in OSX

Marc Feeley feeley at iro.umontreal.ca
Mon Nov 14 10:15:20 EST 2011


On 2011-11-14, at 9:18 AM, Meng Zhang wrote:

> After upgrading from 4.6.1 to 4.6.2, the problem solved.
> Sorry for the outdated information..
> -- 
> Meng Zhang
> Sent with Sparrow
> On 2011年11月14日星期一 at 下午1:39, Meng Zhang wrote:
> 
>> When I played with blackhole's "bh install" command in osx, it stops at "Downloading packages".
>> After I look into the source code, it seems the call to "with-output-to-process" in "untar" function causes this.
>> 
>> Below are code I wrote to reproduce the problem
>> 
>> (with-output-to-process
>>   (list path: "sed"
>>         arguments: '("-e" "s/n/N/g"))
>>   (lambda ()
>>     (display "nothing")))
>> 

Actually, I can't get your example to run without an error on v4.6.2 .  Can I ask you what you expected your code to do?  It is sending the text "nothing" to sed's input.  Are you expecting the output of sed to appear on the terminal?

The procedure with-output-to-process gives to sed a *closed* file descriptor for its stdout.  This is why sed complains ("sed: stdout: Broken pipe").  If you didn't want this, you can give an stdout-redirection: #f setting and sed's stdout will be the same as the interpreter's stdout (usually the terminal):

(with-output-to-process
  (list path: "sed"
        arguments: '("-e" "s/n/N/g")
        stdout-redirection: #f)
  (lambda ()
    (display "nothing\n")))

Perhaps blackhole should also use the stdout-redirection: #f setting.

Marc



More information about the Gambit-list mailing list