runscript.exe and process termination
Siep Kroonenberg
siepo at bitmuis.nl
Mon Sep 28 21:51:36 CEST 2020
On Mon, Sep 28, 2020 at 09:40:12PM +0200, Siep Kroonenberg wrote:
> On Sat, Sep 19, 2020 at 10:41:12AM -0300, Paulo Roberto Massa Cereda wrote:
> > > I looked into this at some time in a different context, but could
> > > not find a good solution. I shall look into it again.
> >
> > Thank you very much for looking into it, Siep. If you need any help with
> > testing whether an adapted version works as intended, feel free to poke the
> > island. :)
> >
> > Em 19/09/2020 10:01, Siep Kroonenberg escreveu:
> > > I looked into this at some time in a different context, but could
> > > not find a good solution. I shall look into it again.
>
> Job objects may be a possible solution, see
> https://docs.microsoft.com/en-us/windows/win32/procthread/job-objects?redirectedfrom=MSDN
> Descendant processes created with CreateProcess will be
> automatically associated with the job, and will be killed
> automatically when the parent job is killed. But simply turning the
> binary wrapper into its own job did not work.
>
> The binary runscript wrapper invokes the luatex dll rather than
> texlua.exe. We could instead invoke texlua.exe via CreateProcess,
> but I am not ready ATM to take that on, for one reason because both
> the binary wrapper and runscript.tlu perform a lot of machinations
> on the argument list. But maybe something can be done from editor
> GUIs and from arara.
>
> I did find a PowerShell script for recursively killing processes,
> given a process ID:
>
> https://stackoverflow.com/questions/55896492/terminate-process-tree-in-powershell-given-a-process-id
>
> function Kill-Tree {
> Param([int]$ppid)
> Get-CimInstance Win32_Process | Where-Object { $_.ParentProcessId -eq $ppid } | ForEach-Object { Kill-Tree $_.ProcessId }
> Stop-Process -Id $ppid
> }
Luatex/texlua does not seem to keep track of process ids, and I saw
no way to do anything from within runscript.tlu.
If there are any options which I overlooked, please let me know.
--
Siep Kroonenberg
More information about the tex-live
mailing list.