On Fri, Sep 21, 2018 at 11:06 AM Taco Hoekwater <taco@elvenkind.com> wrote:

> On 21 Sep 2018, at 10:59, luigi scarso <luigi.scarso@gmail.com> wrote:
> % start demo
> \enabledirectives[system.callbacks.permitoverloads]
> % previous line allows redefinition of ‘wrapup_run’
> iirc ,
> this should be avoided ….

Sure, but I find wrapup_run extremely useful, and I know of no other way to use it.

sure but the idea of modifying the context state (broadly speaking) before that context says that the state is consistent 
(ie the run is  finished, in this case) is , how to say.. hm hm. 
Maybe signalling with an asyn msg that has nothing todo with the context state (just to say "Hey, context here: I am finishing the run" to somebofy else) ,
but usually one wants  also to check the starts and the end of the run as process, ie just before the run starts and just after the run ended.
This case seems safe but I have already dubious on \
$ lua -e ' os.execute("ls \c*") '
lua: (command line):1: invalid escape sequence near '\c'
$ lua -e ' os.execute([[ls \c*]])'
is ok
Also,  I run context foo.tex and at the end  of the runs I found foo.pdf (expected) and doc-<idcode>.pdf ("hm .. where does it come from ? I dont remember ...I have to look into the source" )
so two times the space --- and the copy is done at each run, iirc.

But it's just to complete the picture:  once one  knows the limits, it's a useful callback.