runscript.exe and process termination

Paulo Roberto Massa Cereda cereda.paulo at gmail.com
Sat Sep 19 11:51:09 CEST 2020


Dear friends in the TL list,

TeX Live on Windows uses wrappers around common tools (e.g. latexmk, 
arara etc.) based on the runscript.exe program (runscript.tlu). It is a 
clever approach to provide a consistent, unified entry point to deploy 
binaries in the Windows environment.

While working on issues opened for arara, there were a few mentions that 
process killing on Windows did not work as expected. We (the island) 
decided to investigate what was going on.

To give you some context, we summarized our findings in

https://gitlab.com/islandoftex/arara/-/issues/39

These findings show one real problem on Windows: Processes started from 
editors based on Qt's process management cannot be easily killed because 
their subprocesses will not be terminated (that is how the Windows API 
works).

Now, while we know that especially in this case it is not a problem of 
the wrapper script per se, we would like to point out some code excerpts 
from popular editors:

- TeXworks kills processes using Qt's kill method which, as detailed in 
the issue, does not kill subprocesses:

https://github.com/TeXworks/texworks/blob/c6e85a8e3248ee4b15cd3022ccb77a13d8a42f8d/src/TeXDocumentWindow.cpp#L2786

- TeXmaker kills processes with the same method (line 8165 in 
texmaker.cpp of the current sources of version 5.0.4).

- TeXStudio has written a wrapper (ProcessX) around QProcess but uses 
the same approach for killing applications.

At least three of the more common editors use Qt's method of killing 
processes which will not kill child processes on Windows (because 
Windows does not enforce this concept like unices). That means that 
killing the exe wrapper will actually not propagate the kill signal to 
the actual process that was supposed to be killed which is kind of 
unexpected.

We (the island) were wondering if it would be a good idea for the 
runscript.exe wrapper to kill underlying processes on termination to 
remove the additional “layer” of processes kept alive. I don't know much 
of the inner workings of the wrapper, so apologies to the wrapper 
maintainers if we are asking something too troublesome to implement, as 
we really do not want to add more complexity.

Stay safe!

Cheerio,

Paulo


More information about the tex-live mailing list.