| Store | Cart

Re: [TCLCORE] TIP #462 : Request For Comments

From: <fred...@free.fr>
Tue, 28 Nov 2017 22:45:34 +0100 (CET)

----- Mail original -----
> De: "Donal K. Fellows" <dona...@manchester.ac.uk>> À: fred...@free.fr, tcl-...@lists.sourceforge.net> Envoyé: Lundi 27 Novembre 2017 10:17:13> Objet: Re: [TCLCORE] TIP #462 : Request For Comments> > On 27/11/2017 07:51, fred...@free.fr wrote:> > Sorry I don't understand your question. Just to make things clear,> > no> > changes were made to the existing behavior and semantics of [exec],> > [open |] or anything that relies on> > Tcl_OpenCommandChannel/TclCreatePipeline, besides the extra> > bookkeeping used by tcl::process. And that bookkeeping only blocks> > on> > a single mutex that protects the shared structures (that's> > infoTablesMutex in generic/tclProcess.c).> > OK, in the TIP it says:> > > There is no non-blocking way to query asynchronous subprocess> > status> > codes; catch/try upon open "| command" pipe closure is blocking.> > The non-blocking way of handling that is usually to wait for the> pipeline to send an EOF on its output pipe (which *can* be determined> without blocking) and then to wait synchronously for the termination> code. In almost all usage, that works absolutely fine. The cases> where> this is a problem (where there is no output pipe or where the output> pipe is closed early) are easily handled by launching a helper> subprocess that does a simple blocking [exec] and maintains its own> output pipe handling behaviour such that the outer Tcl process can> follow standard idioms.> > I am deliberately talking about the script-level view here. The> implementation is necessarily platform-specific.
OK, I believe the TIP won't impact this use case then. What the TIP implementation actually does is, add some hooks to the already existing command pipe mechanism in order to maintain a list of spawned child process IDs and statuses (the latter for terminated processes only). When [tcl::process autopurge] is true, it behaves exactly as before. When false, it records the info for later retrieval through [tcl::process (status|list)]. The actual subprocess creation and pipe channel handling is left unchanged.

If you have a sample script that demonstrates this technique I'll be happy to validate it with my implementation or even integrate it into the test suite.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Tcl-Core mailing list
Tcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Recent Messages in this Thread
fred...@free.fr Nov 28, 2017 09:45 pm
Donal K. Fellows Nov 27, 2017 09:17 am
Messages in this thread