Skip to content

JRuby under Java 22+ always thinks it's running under a TTY #8934

@mrnoname1000

Description

@mrnoname1000

Environment Information

  • JRuby version (jruby -v):
    jruby 10.0.0.0-SNAPSHOT (3.4.2) 2025-07-31 55a0013630 OpenJDK 64-Bit Server VM 24.0.1 on 24.0.1 +indy +jit [arm64-darwin]
  • Operating system: Darwin

Bug description

JRuby uses System.console() != null internally to determine whether it's printing to a TTY. On Java 22+, System.console() always returns an object, so System.console().isTerminal() has to be used instead. As it is now, this causes JRuby to print ANSI color codes to non-terminals, e.g. when using -Xir.print.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions