Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b9e1fc52a378
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2f67fdba3a06
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Feb 13, 2017

  1. Copy the full SHA
    900b702 View commit details

Commits on Apr 19, 2017

  1. Merge pull request #4491 from headius/fix-fileno-leak

    Immediately unregister out and err for JSR223 evals. Fixes #4446.
    headius authored Apr 19, 2017
    Copy the full SHA
    2f67fdb View commit details
Showing with 7 additions and 0 deletions.
  1. +7 −0 core/src/main/java/org/jruby/embed/jsr223/Utils.java
7 changes: 7 additions & 0 deletions core/src/main/java/org/jruby/embed/jsr223/Utils.java
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@
import org.jruby.embed.variable.VariableInterceptor;
import org.jruby.internal.runtime.GlobalVariable;
import org.jruby.util.io.BadDescriptorException;
import org.jruby.util.io.ChannelDescriptor;

/**
* A collection of JSR223 specific utility methods.
@@ -152,6 +153,9 @@ private static void setWriter(ScriptingContainer container, Writer writer) throw
runtime.getObject().storeConstant("STDOUT", io);
runtime.getGlobalVariables().alias("$>", "$stdout");
runtime.getGlobalVariables().alias("$defout", "$stdout");

// unregister the fileno so it doesn't leak (jruby/jruby#4446)
ChannelDescriptor.unregisterDescriptor((int) io.fileno(runtime.getCurrentContext()).getLongValue());
}

private static void setErrorWriter(ScriptingContainer container, Writer writer) throws IOException, BadDescriptorException {
@@ -172,6 +176,9 @@ private static void setErrorWriter(ScriptingContainer container, Writer writer)
runtime.defineVariable(new OutputGlobalVariable(runtime, "$stderr", io), GlobalVariable.Scope. GLOBAL);
runtime.getObject().storeConstant("STDERR", io);
runtime.getGlobalVariables().alias("$deferr", "$stderr");

// unregister the fileno so it doesn't leak (jruby/jruby#4446)
ChannelDescriptor.unregisterDescriptor((int) io.fileno(runtime.getCurrentContext()).getLongValue());
}

private static RubyIO getRubyIO(Ruby runtime, Writer writer) throws IOException, BadDescriptorException {