guile-user
[Top][All Lists]
Advanced

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

Re: very obscure problem, help needed


From: Gary Houston
Subject: Re: very obscure problem, help needed
Date: 7 Nov 2000 21:55:59 -0000

> From: Dirk Herrmann <address@hidden>
> Date: Thu, 2 Nov 2000 12:19:55 +0100 (MET)
> 
> On Thu, 2 Nov 2000, David Pirotte wrote:
> 
> > Some time ago, I sent a 'help requested' message, the content of which
> > is further below.
> > 
> > Now I have a better idea on what the problem is, not knowing how I can
> > solve it. Here is the problem:
> 
> Well, I am in no way a posix forking and piping expert, but here is an
> idea:  When you compute the date string, this is done by first forking a
> new child process (i. e. creating a copy of the whole guile system state
> including port states) and then executing the shell command in the child
> process.  Can it be (wild guess!) that both the parent and the child
> process start with some unflushed data in their ports, and that for some
> reason the child flushes its ports (for example on termination), such that
> every time you create a child, the currently not yet flushed ports of the
> parent will be printed?
> 
> You could try this by adding a 'flush-all-ports' command at the beginning
> of your date computing routine.  If this does solve the problem, then we
> would have to fix something in guile's forking procedure.

I've applied some fixes to popen.scm which should make flushing ports
unnecessary.  If anyone is using the popen module from the CVS version,
please update and give it a try.

One visible change is that some file descriptors are now set up from
the current Scheme ports where possible. E.g.,

(use-modules (ice-9 popen))

(with-output-to-file "foo"
  (lambda ()
      (let ((p (open-output-pipe "cat")))
         (display "foo" p)
         (close-pipe p))))

will write "foo" to file "foo".  Any objections?



reply via email to

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