Message9153

Author pekka.klarck
Recipients pekka.klarck, zyasoft
Date 2014-10-14.22:24:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1413325457.07.0.372135796964.issue2221@psf.upfronthosting.co.za>
In-reply-to
Content
Forgot to mention that both POSIX and Windows solutions are based on answers to SO question http://stackoverflow.com/questions/4750470/how-to-get-pid-of-process-ive-just-started-within-java-program and on http://www.golesny.de/p/code/javagetpid linked from there. Getting pid on POSIX and handle on Windows via reflection is pretty trivial, assuming we don't need to care about security managers. Converting a handle to a pid looked pretty complicated in the examples, but after I found out Kernel32 has GetProcessId for exactly that purpose it turned out to be pretty simple too.

I'm nor certain is the above the best way to get pid but at least it is pretty promising. I don't have experience using JMX but could take a look at that too. Do you have pointers where to look?

Regardless the approach we choose, I think not getting a pid shouldn't cause an exception at least directly when the process is started. We could turn Popen.pid into a property and raise an exception if it is accessed, but I'm not sure is that worth the effort. Just setting it to None would be backwards compatible with earlier Jython versions.

After we are ready with the overall design, I can take a look at creating a pull request on GitHub. My experience from them both when reviewing and submitting has been fairly positive. Would it be OK for tests to run a process like `python -c "import os; print os.getpid()"` and compare the output to Popen.pid? In other words, can be assume that devs running tests have python on PATH?
History
Date User Action Args
2014-10-14 22:24:17pekka.klarcksetmessageid: <1413325457.07.0.372135796964.issue2221@psf.upfronthosting.co.za>
2014-10-14 22:24:17pekka.klarcksetrecipients: + pekka.klarck, zyasoft
2014-10-14 22:24:17pekka.klarcklinkissue2221 messages
2014-10-14 22:24:16pekka.klarckcreate