Skip to content

Instantly share code, notes, and snippets.

@headius

headius/.diff Secret

Created April 4, 2019 07:17
Show Gist options
  • Save headius/5a65626f10b9561b411c541a6d0c486d to your computer and use it in GitHub Desktop.
Save headius/5a65626f10b9561b411c541a6d0c486d to your computer and use it in GitHub Desktop.
diff --git a/core/src/main/java/org/jruby/util/io/FilenoUtil.java b/core/src/main/java/org/jruby/util/io/FilenoUtil.java
index 573ca51348..87a12b918b 100644
--- a/core/src/main/java/org/jruby/util/io/FilenoUtil.java
+++ b/core/src/main/java/org/jruby/util/io/FilenoUtil.java
@@ -137,9 +137,10 @@ public class FilenoUtil {
selChImpl = Class.forName("sun.nio.ch.SelChImpl");
try {
getFD = selChImpl.getMethod("getFD");
- if (!Modules.trySetAccessible(getFD)) {
- getFD = null;
- }
+// if (!Modules.trySetAccessible(getFD)) {
+// getFD = null;
+// }
+ getFD.setAccessible(true);
} catch (Exception e) {
getFD = null;
}
@@ -156,9 +157,10 @@ public class FilenoUtil {
fileChannelImpl = Class.forName("sun.nio.ch.FileChannelImpl");
try {
fd = fileChannelImpl.getDeclaredField("fd");
- if (!Modules.trySetAccessible(fd)) {
- fd = null;
- }
+// if (!Modules.trySetAccessible(fd)) {
+// fd = null;
+// }
+ fd.setAccessible(true);
} catch (Exception e) {
fd = null;
}
@@ -172,9 +174,10 @@ public class FilenoUtil {
Field ffd;
try {
ffd = FileDescriptor.class.getDeclaredField("fd");
- if (!Modules.trySetAccessible(ffd)) {
- ffd = null;
- }
+// if (!Modules.trySetAccessible(ffd)) {
+// ffd = null;
+// }
+ ffd.setAccessible(true);
} catch (Exception e) {
ffd = null;
}
[] ~/projects/jruby $ JAVA_OPTS="--add-exports java.base/sun.nio.ch=org.jruby.dist" jruby open3_thing/freeze.rb
jruby 9.2.7.0-SNAPSHOT (2.5.3) 2019-04-03 705834d OpenJDK 64-Bit Server VM 11.0.2+9 on 11.0.2+9 +jit [darwin-x86_64]
{:capture=>"hello, world", :status=>#<Process::Status: pid 7852 exit 0>}
[] ~/projects/jruby $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment