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

Commits on Aug 2, 2017

  1. Copy the full SHA
    71cae54 View commit details
  2. Swap these.

    headius committed Aug 2, 2017
    Copy the full SHA
    6641b2b View commit details
11 changes: 5 additions & 6 deletions core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
@@ -730,13 +730,8 @@ private static void exit(Ruby runtime, IRubyObject[] args, boolean hard) {
/** Returns an Array with the names of all global variables.
*
*/
public static RubyArray global_variables(ThreadContext context, IRubyObject recv) {
return global_variables19(context, recv);
}

// In 1.9, return symbols
@JRubyMethod(name = "global_variables", module = true, visibility = PRIVATE)
public static RubyArray global_variables19(ThreadContext context, IRubyObject recv) {
public static RubyArray global_variables(ThreadContext context, IRubyObject recv) {
Ruby runtime = context.runtime;
RubyArray globalVariables = runtime.newArray();

@@ -747,6 +742,10 @@ public static RubyArray global_variables19(ThreadContext context, IRubyObject re
return globalVariables;
}

public static RubyArray global_variables19(ThreadContext context, IRubyObject recv) {
return global_variables(context, recv);
}

/** Returns an Array with the names of all local variables.
*
*/
15 changes: 7 additions & 8 deletions core/src/main/java/org/jruby/ext/io/wait/IOWaitLibrary.java
Original file line number Diff line number Diff line change
@@ -147,21 +147,19 @@ public static IRubyObject wait(ThreadContext context, IRubyObject _io, IRubyObje
case "rw":
case "read_write":
case "readable_writable":
ops |= SelectionKey.OP_ACCEPT | SelectionKey.OP_READ;
ops |= SelectionKey.OP_CONNECT | SelectionKey.OP_WRITE;
ops |= SelectionKey.OP_ACCEPT | SelectionKey.OP_READ | SelectionKey.OP_CONNECT | SelectionKey.OP_WRITE;
break;
default:
throw context.runtime.newArgumentError("unsupported mode: " + sym);
}

throw context.runtime.newArgumentError("unsupported mode: " + sym);
} else {
throw context.runtime.newArgumentError("unsupported mode: " + argv[1].getType());
}
} else if (argv.length == 1) {
} else {
ops |= SelectionKey.OP_ACCEPT | SelectionKey.OP_READ;
}

if ((ops & SelectionKey.OP_READ) != 0) {
if (fptr.readPending() != 0) return context.tru;
}
if ((ops & SelectionKey.OP_READ) == SelectionKey.OP_READ && fptr.readPending() != 0) return context.tru;

long tv = prepareTimeout(context, argv);

@@ -179,6 +177,7 @@ private static long prepareTimeout(ThreadContext context, IRubyObject[] argv) {
IRubyObject timeout;
long tv;
switch (argv.length) {
case 2:
case 1:
timeout = argv[0];
break;
9 changes: 8 additions & 1 deletion core/src/main/java/org/jruby/util/io/OpenFile.java
Original file line number Diff line number Diff line change
@@ -508,7 +508,14 @@ public boolean ready(Ruby runtime, RubyThread thread, int ops, long timeout) {
boolean locked = lock();
try {
if (fd.chSelect != null) {
return thread.select(fd.chSelect, this, ops & fd.chSelect.validOps(), timeout);
int realOps = ops & fd.chSelect.validOps();

if ((realOps & SelectionKey.OP_WRITE) != (ops & SelectionKey.OP_WRITE)) {
// MRI or poll or select appears to return ready for write select on a read-only channel
return true;
}

return thread.select(fd.chSelect, this, realOps, timeout);

} else if (fd.chSeek != null) {
return fd.chSeek.position() != -1