[Larceny-users] process broken?

Felix Klock felixluser at pnkfx.org
Mon Jun 23 13:23:32 EDT 2008


Will (cc'ing Ken and larceny-users)-

On Jun 21, 2008, at 9:01 PM, William D Clinger wrote:

>> I am trying to use the 'process proc in "lib/Standard/unix.scm".
>>
>> Can someone help me out?
>
> Your immediate problem is that the two ports created
> by process are binary ports, not textual ports.	 (The
> error message for write-char should have said	its
> argument was not a textual output port.  I changed
> that error message just	now in response	to your	bug
> report.)
>
> Using binary i/o, however, I encounter yet another
> problem: a broken pipe when I attempt to flush or to
> close the output port.	I don't	see anything obviously
> wrong with the code, so I'm going to ask Felix about
> this.

The broken pipe does seem undesirable, since it kills the Larceny  
process itself.

(FYI, I only see the broken pipe when flushing the output to the echo  
process on Solaris, not on Linux or Mac OS X, and also not when  
flushing the output to some other processes, such as cat.  So one  
thing to check is whether the echo program on Solaris has subtle  
differences in its behavior from the one on Linux or Mac OS X.)

Ken: what was the goal of your original experiments with process?  I  
do not think the result of evaluating (process "echo") is terribly  
interesting to interact with.  I would have thought (process "cat")  
would be a more interesting process to interact with (or at least pass  
some arguments to echo so that you can see output from it).

Just to put us all on the same page, here are the experiments I used:

% /proj/will/pnkfelix/larcenytest/larceny-native-Nightly-2008-06-23/ 
larceny_src/larceny
Larceny v0.961 "Fluoridation" (Jun 23 2008 04:24:45,  
precise:SunOS5:split)

 > (require "Standard/unix")
#t

 > (define (test cmd input-string output-n flush?) (let* ((t (native- 
transcoder)) (p (process cmd)) (op (cadr p)) (ip (car p))) (put- 
bytevector op (string->bytevector input-string t)) (if flush? (flush- 
output-port op)) (bytevector->string (get-bytevector-n ip output-n) t)))

 > (test "cat" "Input to cat" 10 #t)
"Input to c"

 > (test "cat" "Input to cat" 10 #f) ;; waited a while and then hit  
Ctrl-C
Keyboard interrupt.
Entering debugger; type "?" for help.
debug> q

 > (test "echo Arg of echo" "Input to echo" 10 #f)
"Arg of ech"

 > (test "echo Arg of echo" "Input to echo" 10 #t)
Broken Pipe
%



By the way, there was *one* instance where I entered the same text as  
above and did not get a Broken Pipe, so the broken pipe may be  
resulting from underlying nondeterministic behavior.  But almost all  
of the times I did the above steps, I would get a broken pipe, so the  
problem seems to be reasonable to reproduce...

-Felix





More information about the Larceny-users mailing list