Notes on fixing a Java issue on Mac OS Big Sur

When last we met, I was left with a broken test tool on the newer Mac laptops [1]. The issue at hand is that it's problematic to obtain process ID (Identifier)s in Java, which the testing tool needs for two things. The first is an output file. It turns out one can specify the output file the SIP (Session Initiation Protocol) injection tool generates instead of the default one which uses a process ID. This also makes it easier to check the output since you don't have to grovel through the directory for an ever-changing file name. That issue fixed.

The second one—how to stop the program that runs all the programs that are being tested. The code used the process ID to terminate that program by shelling out to run kill -SIGINT pid. It turns out the Java Process object does have a destroy() method [2] (it sends a SIGTERM to a process, which is fine). It was just a simple matter to update the code to use the destroy() method to terminate the program rather than trying to obtain the process ID in a dodgy way. That issue fixed.

Now all I have to do is spend a few weeks trying to get the code commited to the repository (yeah, I'm still trying to get used to the process—sigh).

[1] /boston/2022/04/21.1

[2] https://docs.oracle.com/javase/7/docs/api/java/lang/Process.html

Gemini Mention this post

Contact the author