Permalink
Browse files

Do not depend on console to properly encode to proper tty-friendly ch…

…ars on windows if the JVM was started without a console.
  • Loading branch information...
1 parent cde69f8 commit cfee0e7de6a7c2ddfa724cdc238831395394404b @enebo enebo committed Mar 3, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 core/src/main/java/org/jruby/RubyIO.java
@@ -1464,7 +1464,7 @@ protected int fwrite(RubyString buffer) {
// console() can detect underlying windows codepage so we will just write to it
// and hope it is legible.
- if (Platform.IS_WINDOWS && tty_p(getRuntime().getCurrentContext()).isTrue()) {
+ if (Platform.IS_WINDOWS && tty_p(getRuntime().getCurrentContext()).isTrue() && System.console() != null) {
System.console().printf("%s", buffer.asJavaString());
return len;
}

0 comments on commit cfee0e7

Please sign in to comment.