Skip to content

Commit

Permalink
Add Windows platform masks to get JRuby + RubyGems booting again.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Jan 14, 2015
1 parent e8ca19d commit 9f4d9a4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyGlobal.java
Expand Up @@ -276,7 +276,7 @@ public static void createGlobals(ThreadContext context, Ruby runtime) {
}

private static Channel prepareStdioChannel(Ruby runtime, STDIO stdio, Object stream) {
if (runtime.getPosix().isNative() && stdio.isJVMDefault(stream)) {
if (runtime.getPosix().isNative() && stdio.isJVMDefault(stream) && !Platform.IS_WINDOWS) {
// use real native channel for stdio
return new NativeDeviceChannel(stdio.fileno());
} else {
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/util/RegularFileResource.java
Expand Up @@ -17,6 +17,7 @@

import org.jruby.ext.fcntl.FcntlLibrary;
import org.jruby.RubyFile;
import org.jruby.platform.Platform;
import org.jruby.util.io.ModeFlags;
import org.jruby.util.io.PosixShim;

Expand Down Expand Up @@ -154,7 +155,7 @@ InputStream openInputStream() throws IOException {

@Override
public Channel openChannel(ModeFlags flags, int perm) throws ResourceException {
if (posix.isNative()) {
if (posix.isNative() && !Platform.IS_WINDOWS) {
int fd = posix.open(absolutePath(), flags.getFlags(), perm);
if (fd < 0) {
Errno errno = Errno.valueOf(posix.errno());
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/util/io/ChannelFD.java
Expand Up @@ -5,6 +5,7 @@
import jnr.posix.FileStat;
import jnr.posix.POSIX;
import org.jruby.Ruby;
import org.jruby.platform.Platform;

import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -47,7 +48,7 @@ private void initFileno() {
}

public ChannelFD dup() {
if (realFileno != -1) {
if (realFileno != -1 && !Platform.IS_WINDOWS) {
// real file descriptors, so we can dup directly
// TODO: investigate how badly this might damage JVM streams (prediction: not badly)
return new ChannelFD(new NativeDeviceChannel(posix.dup(realFileno)), posix, filenoUtil);
Expand Down

0 comments on commit 9f4d9a4

Please sign in to comment.