chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Can't get exit values of (process...)?


From: Zbigniew
Subject: Re: [Chicken-users] Can't get exit values of (process...)?
Date: Wed, 17 Jan 2007 13:45:03 -0600

Robin,

Did you try using process-fork to create the process, as Felix
suggested?  The process can't "end" until you actually call
process-wait.  In fact, you normally should call process-wait to
properly reap your children.  If you are noticing your children are
being reaped automatically on your system, without calling wait(), you
could try ensuring SIGCHLD is set to SIG_DFL (default signal handler)
and not SIG_IGN, which may cause automatic reaping on some systems.  I
personally find the Perl documentation to be a nice quick reference
for IPC issues.

On 1/17/07, Robin Lee Powell <address@hidden> wrote:
On Wed, Jan 17, 2007 at 11:26:27AM +0100, felix winkelmann wrote:
> On 1/17/07, Robin Lee Powell <address@hidden> wrote:
> >On Sun, Jan 14, 2007 at 09:53:00PM -0800, Robin Lee Powell wrote:
> >>
> >> The only way I see to get the exit value of something I call
> >> with (process...) is to use (process-wait), but as I mentioned
> >> in another mail, this errors out my entire program if the
> >> process is already finished, so I can't see any way to do all
> >> of the following:
> >>
>
> If you start a subprocess with `process', the waitpid(2) is done
> by closing the input and output port returned. If you want to get
> at the exit-status, you should try to start a process via more
> primitive functions, like `process-fork'. There a `process-wait'
> gives you all necessary information (and the error can be caught
> using `handle-exceptions'). To get at stdin/out, one can use the
> usual fork/dup/exec dance to obtain file-descriptors (albeit in
> Scheme using the functionality in the posix unit).

The problem is, the programs I'm calling tend to complete the
instant I gather their output.  If the program is gone by the time I
call process-wait, I don't get the exit status, so this really
doesn't help me.

I'm looking for something like the shell's $? here.  Can I maybe
hack process to do that?




reply via email to

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