chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Wierd behaviour of process.


From: Robin Lee Powell
Subject: Re: [Chicken-users] Wierd behaviour of process.
Date: Sun, 14 Jan 2007 11:17:17 -0800
User-agent: Mutt/1.5.13 (2006-08-11)

On Sun, Jan 14, 2007 at 09:20:15AM -0800, Kon Lovett wrote:
> On Jan 12, 2007, at 11:32 PM, Robin Lee Powell wrote:
> >
> >In the middle of the Scheme binding I wrote for mooix, I call
> >process (from posix) for IPC.  The system is, in total, very
> >complex; so much so that I don't even know where to start to at
> >making a pared-down example.
> >
> >So, I'll describe the behaviour.
> >
> >I run process in the same way (see
> >http://paste.lisp.org/display/35085 for my code; at least, that's
> >what it looked like after I had hacked it for a while trying to
> >solve this problem) quite a number of times.  At one point, process
> >calls a Perl script that is set sticky (not that I think that
> >matters, but there you are) that returns no output at all.  process
> >correctly sees it as returning no output.  The *next* call to
> >process appends a string, call it StringX, to the real output of the
> >process it calls, for no apparent reason.
> 
> 1) What Chicken version?

I upgraded to 2.5 as part of trying to figure this out.

> 2) In the code you 'pasted' you are treating the ports returned by
> process as 2-way but they are only 1-way (they are not pipes).
> Shouldn't be a major issue but it is wrong.

I wanted to be Absolutely Sure they were closed.  :-)

The current version, and most versions I tested with, just does:

(close-output-port toport)
(define output (read-all fromport))
(close-input-port fromport)

> 3) You don't really need to close the input-port before reading.
> Although closing both will cause the system to "wait" the process.

That made me think that doing a "wait" on the process *is* behaviour
I want, and I should do that.  However, process-wait throws an error
if the process has already exited, and I can't seem to trap it.  I
tried:

(condition-case (process-wait pid) (var () #t))

and

(with-exception-handler (lambda (x) #f) (lambda () (process-wait
pid)))

But in both cases it just errors out with:

Error: (process-wait) waiting for child process failed - No child
processes: 21505

:-(

> 4) When you say "*next*" call to process do you mean the next use
> of  process w/ any command-path, or the next use of process w/ the
> aforementioned Perl script?

The former.  It is definately a different command path that gets a
bunch of lies in the output stream.

-Robin

-- 
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
Reason #237 To Learn Lojban: "Homonyms: Their Grate!"
Proud Supporter of the Singularity Institute - http://singinst.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]