Skip to content

Use Java 9+ Process.pid() to get pid#8354

Merged
headius merged 2 commits intojruby:masterfrom
headius:java9_process_pid
Oct 29, 2024
Merged

Use Java 9+ Process.pid() to get pid#8354
headius merged 2 commits intojruby:masterfrom
headius:java9_process_pid

Conversation

@headius
Copy link
Member

@headius headius commented Sep 24, 2024

This avoids using reflection to access Process internals on JDK versions 9 and higher, reducing our our requirements for opening core JDK classes. In JRuby 10, we will remove all the reflective logic since that release targets at least Java 17.

This may help fix #7515 by providing access to a real pid on Java 9+ regardless of reflection access.

This avoids using reflection to access Process internals on JDK
versions 9 and higher, reducing our our requirements for opening
core JDK classes. In JRuby 10, we will remove all the reflective
logic since that release targets at least Java 17.

This may help fix jruby#7515 by providing access to a real
pid on Java 9+ regardless of reflection access.
The base pid() (from Java 9+) depends on toHandle() being
overridden and raises an error if that has not happened. However
that method returns instances of ProcessHandle, also added in 9,
so there's no way we can implement it for 8. This patch just
overrides pid() altogether so toHandle() is not called.
@headius headius merged commit 9bcc2eb into jruby:master Oct 29, 2024
@headius headius deleted the java9_process_pid branch October 29, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Process.wait and Process.wait2 not behaving as expected on Windows with JDK > 8

1 participant