FYI,
call stack in 4.1
0  ##thread-check-interrupts! 
1  ##thread-sleep!         
2  ##process-status        
3  with-output-to-process  

-- 
Meng Zhang
Sent with Sparrow

On 2011年11月15日星期二 at 上午10:15, Meng Zhang wrote:



On Tue, Nov 15, 2011 at 10:04 AM, Marc Feeley <feeley@iro.umontreal.ca> wrote:

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?
Yes, it prints "NothiNg" and then fall asleep without exiting.(in 4.6.1)

Marc




--
Zhang Meng
School of Software Engineering, Tongji University
MP: +86 151-2103-2798