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: 856857255e58
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3766e89176b8
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Apr 19, 2017

  1. Special-case IO.open for stdio on Windows. Fixes #3625.

    Windows does not yet support our fully-native IO, but this path
    still tried to use that logic. Since we can't wrap all native
    file descriptors, this logic is only special-cased for stdio.
    Other descriptors that are not "fake" (already inside our internal
    map) will fail this logic rather than fall into half-working
    native IO.
    headius committed Apr 19, 2017
    Copy the full SHA
    19b5424 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3766e89 View commit details
Showing with 19 additions and 2 deletions.
  1. +19 −2 core/src/main/java/org/jruby/RubyIO.java
21 changes: 19 additions & 2 deletions core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -892,7 +892,24 @@ private IRubyObject initializeCommon(ThreadContext context, int fileno, IRubyObj
fd = runtime.getFilenoUtil().getWrapperFromFileno(fileno);

if (fd == null) {
fd = new ChannelFD(new NativeDeviceChannel(fileno), runtime.getPosix(), runtime.getFilenoUtil());
if (Platform.IS_WINDOWS) {
// Native channels don't work quite right on Windows yet. See jruby/jruby#3625
switch (fileno) {
case 0:
fd = new ChannelFD(Channels.newChannel(runtime.getIn()), runtime.getPosix(), runtime.getFilenoUtil());
break;
case 1:
fd = new ChannelFD(Channels.newChannel(runtime.getOut()), runtime.getPosix(), runtime.getFilenoUtil());
break;
case 2:
fd = new ChannelFD(Channels.newChannel(runtime.getErr()), runtime.getPosix(), runtime.getFilenoUtil());
break;
default:
throw runtime.newErrnoEBADFError("Windows does not support wrapping native file descriptor: " + fileno);
}
} else {
fd = new ChannelFD(new NativeDeviceChannel(fileno), runtime.getPosix(), runtime.getFilenoUtil());
}
}
} else {
ChannelFD descriptor = runtime.getFilenoUtil().getWrapperFromFileno(fileno);
@@ -4713,7 +4730,7 @@ public RubyIO(Ruby runtime, STDIO stdio) {
tmp = prepStdio(runtime, runtime.getOut(), Channels.newChannel(runtime.getOut()), OpenFile.WRITABLE, runtime.getIO(), "<STDOUT>");
break;
case ERR:
tmp = prepStdio(runtime, runtime.getIn(), Channels.newChannel(runtime.getErr()), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");
tmp = prepStdio(runtime, runtime.getErr(), Channels.newChannel(runtime.getErr()), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");
break;
}