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

Marc Feeley feeley at iro.umontreal.ca
Mon Nov 14 21:04:52 EST 2011


On 2011-11-14, at 8:40 PM, Meng Zhang wrote:

> >> 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?  
> This problem happened in 4.6.1, not 4.6.2

I understand.  But you said that once you upgraded to v4.6.2 the problem went away.  But when I try with v4.6.2 I get the same result as v4.6.1 on the code above.  So I am wondering why there is a difference on v4.6.2.

> 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):
> In 4.6.1, when I run the code above, the current thread sleeps forever.(since the stack frame is at "thread-sleep!")

What happens when you try the code below?

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

Do you get the output on the screen?

Marc




More information about the Gambit-list mailing list