> Java 9 introduced richer process control APIs which might suffice for the particular use cases in Jenkins
Alas much of that is unimplemented on windows. Don't know why as it is available as winp prooved.. (Command line and arguments for one, ability to gracefully kill (aka ctrl-c?)) Given that doesn't work and there is not really a hierarchy in windows processes I doubt (but did not check) the child processes work either. On Thu, 4 Apr 2024, 23:01 'Jesse Glick' via Jenkins Developers, < [email protected]> wrote: > On Thu, Mar 28, 2024 at 8:02 AM Pierrick Bouvier < > [email protected]> wrote: > >> for winp, I'm not sure what we are missing by not being able to load this >> DLL (less control on processes launched?) >> > > I think it would be worthwhile to search for usages of winp in > @jenkinsci—probably > mostly confined to Jenkins core, such as in `ProcessTree`, though plugins > are not blocked from using it—and checking whether it could simply be > retired. Not loading native libraries is generally desirable anyway. Java 9 > introduced richer process control APIs which might suffice for the > particular use cases in Jenkins. The main usage of all this code that I am > aware of is to kill off whole process subtrees during builds, typically on > an agent. Say you had a Pipeline such as > > node('something-remote') { > sh ''' > export DISPLAY=:999 > xvfb & > make gui-tests > ''' > } > > with no join on the background task. By the close of the `node` block, it > is expected that all processes started during the user script have been > killed off. This is currently done by passing a special random “cookie” as > an environment variable to the main shell script, which should be inherited > by descendant processes, and finally searching for any remaining processes > with that environment set and sending them a termination signal. Maybe this > could be replaced with a `ProcessHandle.descendants` call? > (`durable-task` runs the user process in the background, however, and this > can survive parent JVM sessions.) > > Even if there is not a simple solution using the Java Platform, I am > guessing winp specifically could be removed in favor of executing `wmic` > commands or something like that, or that could be a fallback in case of an > unsupported binary platform. > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3HJnh8XuzRebGexFWmWdn5TFT2JiUzgHwmKSxPzP%2B%2B_Q%40mail.gmail.com > <https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3HJnh8XuzRebGexFWmWdn5TFT2JiUzgHwmKSxPzP%2B%2B_Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPzq3pekypa%2BXOam9TZsw4Uyd7udT%2BqtLThnHszFB-jrSjAnnA%40mail.gmail.com.
