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: 715de4224b6e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 68d281e52163
Choose a head ref
  • 3 commits
  • 16 files changed
  • 1 contributor

Commits on Jan 16, 2015

  1. Copy the full SHA
    4881e35 View commit details
  2. Use a different exception for Enumerator termination.

    We are trying to eliminate these JumpException subclasses.
    headius committed Jan 16, 2015
    Copy the full SHA
    4b89ab9 View commit details
  3. Copy the full SHA
    68d281e View commit details
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.0.0.0-SNAPSHOT
9.0.0.0.pre1
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-parent</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</parent>
<artifactId>jruby-core</artifactId>
<name>JRuby Core</name>
@@ -42,7 +42,7 @@
<parser.dir>core/src/main/java/org/jruby/parser</parser.dir>
<jruby.basedir>${basedir}/..</jruby.basedir>
<rubyspec.dir>${spec.dir}/ruby</rubyspec.dir>
<version.ruby.revision>48765</version.ruby.revision>
<version.ruby.revision>49005</version.ruby.revision>
<jruby.test.memory>3G</jruby.test.memory>
<mspec.dir>${spec.dir}/mspec</mspec.dir>
<build.date>${maven.build.timestamp}</build.date>
17 changes: 12 additions & 5 deletions core/src/main/java/org/jruby/RubyEnumerator.java
Original file line number Diff line number Diff line change
@@ -29,8 +29,8 @@

import org.jruby.anno.JRubyMethod;
import org.jruby.anno.JRubyModule;
import org.jruby.exceptions.JumpException;
import org.jruby.exceptions.RaiseException;
import org.jruby.exceptions.Unrescuable;
import org.jruby.runtime.Arity;
import org.jruby.runtime.Block;
import org.jruby.runtime.BlockCallback;
@@ -596,6 +596,9 @@ private static class ThreadedNexter extends Nexter implements Runnable {

/** the last value we got, used for peek */
private IRubyObject lastValue;

/** Exception used for unrolling the iteration on terminate */
private static class TerminateEnumeration extends RuntimeException implements Unrescuable {}

public ThreadedNexter(Ruby runtime, IRubyObject object, String method, IRubyObject[] methodArgs) {
super(runtime, object, method, methodArgs);
@@ -708,25 +711,29 @@ public void run() {

try {
IRubyObject oldExc = runtime.getGlobalVariables().get("$!");
final TerminateEnumeration terminateEnumeration = new TerminateEnumeration();
try {
object.callMethod(context, method, methodArgs, CallBlock.newCallClosure(object, object.getMetaClass(), Arity.OPTIONAL, new BlockCallback() {
@Override
public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) {
try {
if (DEBUG) System.out.println(Thread.currentThread().getName() + ": exchanging: " + Arrays.toString(args));
if (die) throw new JumpException.BreakJump(-1, NEVER);
if (die) throw terminateEnumeration;
out.put(RubyEnumerable.packEnumValues(runtime, args));
if (die) throw new JumpException.BreakJump(-1, NEVER);
if (die) throw terminateEnumeration;
} catch (InterruptedException ie) {
if (DEBUG) System.out.println(Thread.currentThread().getName() + ": interrupted");

throw new JumpException.BreakJump(-1, NEVER);
throw terminateEnumeration;
}

return context.nil;
}
}, context));
} catch (JumpException.BreakJump bj) {
} catch (TerminateEnumeration te) {
if (te != terminateEnumeration) {
throw te;
}
// ignore, we're shutting down
} catch (RaiseException re) {
runtime.getGlobalVariables().set("$!", oldExc);
33 changes: 33 additions & 0 deletions core/src/main/ruby/jruby/kernel/io.rb
Original file line number Diff line number Diff line change
@@ -12,4 +12,37 @@ class EAGAINWaitWritable < Errno::EAGAIN
class EINPROGRESSWaitWritable < Errno::EINPROGRESS
include IO::WaitWritable
end

# We provided this as an unofficial way to do "open4" on JRuby (since open4 gem depends on fork),
# and unfortunately people started using it. So I think we're stuck with it now (at least until
# we can fix the open4 gem to do what we do below).
# FIXME: I don't think spawn works on Windows yet, but the old IO.popen4 did.
# FIXME: Mostly copied from open3.rb impl of popen3.
def self.popen4(*cmd, **opts)
in_r, in_w = IO.pipe
opts[:in] = in_r
in_w.sync = true

out_r, out_w = IO.pipe
opts[:out] = out_w

err_r, err_w = IO.pipe
opts[:err] = err_w

child_io = [in_r, out_w, err_w]
parent_io = [in_w, out_r, err_r]

pid = spawn(*cmd, opts)
child_io.each {|io| io.close }
result = [pid, *parent_io]
if block_given?
begin
return yield(*result)
ensure
parent_io.each{|io| io.close unless io.closed?}
Process.waitpid(pid)
end
end
result
end
end
5 changes: 3 additions & 2 deletions lib/pom.xml
Original file line number Diff line number Diff line change
@@ -5,12 +5,13 @@
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-parent</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</parent>
<artifactId>jruby-lib</artifactId>
<packaging>pom</packaging>
<name>JRuby Lib Setup</name>
<properties>
<jruby.home>${basedir}/..</jruby.home>
<tesla.dump.readonly>true</tesla.dump.readonly>
<jruby.plugins.version>1.0.5</jruby.plugins.version>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
@@ -20,7 +21,7 @@
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-core</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</dependency>
<dependency>
<groupId>rubygems</groupId>
3 changes: 2 additions & 1 deletion maven/jruby-complete/pom.xml
Original file line number Diff line number Diff line change
@@ -5,12 +5,13 @@
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-artifacts</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</parent>
<artifactId>jruby-complete</artifactId>
<packaging>bundle</packaging>
<name>JRuby Complete</name>
<properties>
<jruby.home>${basedir}/../..</jruby.home>
<tesla.dump.readonly>true</tesla.dump.readonly>
<main.basedir>${project.parent.parent.basedir}</main.basedir>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
5 changes: 3 additions & 2 deletions maven/jruby-dist/pom.xml
Original file line number Diff line number Diff line change
@@ -5,14 +5,15 @@
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-artifacts</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</parent>
<artifactId>jruby-dist</artifactId>
<packaging>pom</packaging>
<name>JRuby Dist</name>
<properties>
<jruby.home>${basedir}/../..</jruby.home>
<tesla.dump.readonly>true</tesla.dump.readonly>
<jruby.plugins.version>1.0.3</jruby.plugins.version>
<jruby.plugins.version>1.0.7</jruby.plugins.version>
<main.basedir>${project.parent.parent.basedir}</main.basedir>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
<tesla.version>0.1.1</tesla.version>
14 changes: 10 additions & 4 deletions maven/jruby-jars/pom.xml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-artifacts</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</parent>
<groupId>rubygems</groupId>
<artifactId>jruby-jars</artifactId>
@@ -18,12 +18,18 @@ freezing to) a specific jruby-complete jar version.</description>
<licenses>
<license>
<name>EPL-1.0</name>
<url>http://opensource.org/licenses/EPL-1.0</url>
<comments>Eclipse Public License 1.0</comments>
</license>
<license>
<name>GPL-2.0</name>
<url>http://opensource.org/licenses/GPL-2.0</url>
<comments>GNU General Public License version 2.0</comments>
</license>
<license>
<name>LGPL-2.1</name>
<url>http://opensource.org/licenses/LGPL-2.1</url>
<comments>GNU Library or "Lesser" General Public License version 2.1</comments>
</license>
</licenses>
<developers>
@@ -37,11 +43,11 @@ freezing to) a specific jruby-complete jar version.</description>
<url>http://github.com/jruby/jruby/tree/master/gem/jruby-jars</url>
</scm>
<properties>
<jruby.home>${basedir}/../..</jruby.home>
<tesla.dump.readonly>true</tesla.dump.readonly>
<gem.home>${jruby.home}/lib/ruby/gems/shared</gem.home>
<jruby.plugins.version>1.0.7</jruby.plugins.version>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<jruby_home>${basedir}/../../</jruby_home>
<tesla.version>0.1.1</tesla.version>
</properties>
@@ -67,7 +73,7 @@ freezing to) a specific jruby-complete jar version.</description>
</extension>
</extensions>
<directory>${basedir}/pkg</directory>
<finalName>${project.artifactId}-9.0.0.0.SNAPSHOT</finalName>
<finalName>${project.artifactId}-9.0.0.0.pre1-SNAPSHOT</finalName>
<plugins>
<plugin>
<groupId>de.saumya.mojo</groupId>
@@ -114,7 +120,7 @@ freezing to) a specific jruby-complete jar version.</description>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<properties>
<ruby.version>9.0.0.0.SNAPSHOT</ruby.version>
<ruby.version>9.0.0.0.pre1-SNAPSHOT</ruby.version>
<gem.home>${project.build.directory}/rubygems</gem.home>
<gem.path>${project.build.directory}/rubygems</gem.path>
</properties>
3 changes: 2 additions & 1 deletion maven/jruby-noasm/pom.xml
Original file line number Diff line number Diff line change
@@ -5,11 +5,12 @@
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-artifacts</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</parent>
<artifactId>jruby-noasm</artifactId>
<name>JRuby Main Maven Artifact With ASM Relocated</name>
<properties>
<jruby.home>${basedir}/../..</jruby.home>
<tesla.dump.readonly>true</tesla.dump.readonly>
<main.basedir>${project.parent.parent.basedir}</main.basedir>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
11 changes: 6 additions & 5 deletions maven/jruby-stdlib/pom.xml
Original file line number Diff line number Diff line change
@@ -5,19 +5,20 @@
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-artifacts</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</parent>
<artifactId>jruby-stdlib</artifactId>
<name>JRuby Stdlib</name>
<properties>
<tesla.dump.readonly>true</tesla.dump.readonly>
<jruby.complete.gems>${jruby.complete.home}/lib/ruby/gems/shared</jruby.complete.gems>
<main.basedir>${project.parent.parent.basedir}</main.basedir>
<tesla.version>0.1.1</tesla.version>
<gem.home>${jruby_home}/lib/ruby/gems/shared</gem.home>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
<main.basedir>${project.parent.parent.basedir}</main.basedir>
<jruby.complete.home>${project.build.outputDirectory}/META-INF/jruby.home</jruby.complete.home>
<jruby_home>${basedir}/../..</jruby_home>
<tesla.version>0.1.1</tesla.version>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
<tesla.dump.readonly>true</tesla.dump.readonly>
<jruby.home>${basedir}/../..</jruby.home>
</properties>
<build>
<resources>
3 changes: 2 additions & 1 deletion maven/jruby/pom.xml
Original file line number Diff line number Diff line change
@@ -5,11 +5,12 @@
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-artifacts</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</parent>
<artifactId>jruby</artifactId>
<name>JRuby Main Maven Artifact</name>
<properties>
<jruby.home>${basedir}/../..</jruby.home>
<tesla.dump.readonly>true</tesla.dump.readonly>
<main.basedir>${project.parent.parent.basedir}</main.basedir>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
2 changes: 1 addition & 1 deletion maven/pom.xml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-parent</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
</parent>
<artifactId>jruby-artifacts</artifactId>
<packaging>pom</packaging>
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
</parent>
<groupId>org.jruby</groupId>
<artifactId>jruby-parent</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<version>9.0.0.0.pre1</version>
<packaging>pom</packaging>
<name>JRuby</name>
<description>JRuby is the effort to recreate the Ruby (http://www.ruby-lang.org) interpreter in Java.</description>
@@ -138,6 +138,7 @@
<power_assert.version>0.1.4</power_assert.version>
<version.jruby>${project.version}</version.jruby>
<bouncy-castle.version>1.47</bouncy-castle.version>
<jruby.home>${basedir}/..</jruby.home>
<main.basedir>${project.basedir}</main.basedir>
<github.global.server>github</github.global.server>
<joda.time.version>2.5</joda.time.version>
16 changes: 15 additions & 1 deletion spec/regression/JRUBY-6291_popen_close_streams_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
require 'rbconfig'

describe 'JRUBY-6291: Closing Stream in Open3.popen3' do
describe 'JRUBY-6291: Closing Stream in IO.popen4 and Open3.popen3' do
it 'should not error when reading from other streams using IO.popen4' do
if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
command = "#{ENV['COMSPEC']} /c echo success"
else
command = '/bin/echo success'
end
output = ""
IO.popen4(command) do |pid, stdin, stdout, stderr|
stdin.close
stdout.each_line { |l| output << l }
end
output.strip.should == 'success'
end

it 'should not error when reading from other streams using Open3.popen3' do
if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
command = "#{ENV['COMSPEC']} /c echo success"
2 changes: 1 addition & 1 deletion test/jruby/test_io.rb
Original file line number Diff line number Diff line change
@@ -428,7 +428,7 @@ def ensure_files(*files)

# JRUBY-4908 ... Solaris is commented out for now until I can figure out why
# ci will not run it properly.
if !WINDOWS && !SOLARIS && false # temporarily disable
if !WINDOWS && !SOLARIS
def test_sh_used_appropriately
# should not use sh
p, o, i, e = IO.popen4("/bin/ps -a -f")
Loading