Alexandre Ferrieux | 3 Jul 09:47
Picon

Re: Future [exec] overhaul

Hello Joe,

On Thu, Jul 3, 2008 at 7:56 AM, Joe English <jenglish@...> wrote:
>
> My preferred solution would be a callback: [exec2]
> would take a -command option (after each process) that
> specifies a script prefix (or better: a command prefix)
> that will be evaluated when the process in question exits,
> appending (or lappending) the exit code (and maybe the PID
> or whatever else is useful) before evaluation (or invocation).

OK, so a dedicated script-level signal handler. I like it.

> This can be implemented in a number of ways -- SIGCHLD handler +
> Tcl_AsyncMark, periodic nonblocking waitpid()s called from
> an EventSource, a patch to Tcl_ReapDetachedProcs, etc., --
> not sure which would work best -- but I definitely think
> a callback -- "tell me when the process has exited and why" --
> is the best way to go.

I think on unix the first one is the way to go (Tcl_AsyncMark was
invented exactly for this kind of task; periodic tasks would be an
ugly first-of-a-kind; and Tcl_Reap* is currently called at too coarse
a grain ([exec] and [close] IIRC, and not in the event loop).

On Windows I assume one must add the process handle to
WaitForMultipleObjects, which relates to adding an event source...

> I have some design notes on this topic lying around somewhere.
> Will dig them up and try to describe in a more comprehensible manner
> what I had in mind.

Will be glad to co-author the new TIP with you.

> But for now: +1 on all four points above.

Thanks a lot for your support Joe.

-Alex

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08

Gmane