Skip to content

JRuby stderr stream redirected with standard ">" redirect #58

@adamsnd

Description

@adamsnd

Environment Information

  • JRuby 9.3.15, 9.4.12.1, 10.0.1.0 on - all versions exhibited same behaviors
  • Ruby tests on Ruby 2.6.10
  • Win11Pro 26100.4652

Code:
bugtest.rb containing only these two lines:

puts "stdout"
$stderr.puts "stderr"

Expected Behavior
Command line redirect ">" should redirect stdout stream but not stderr stream. stderr stream should remain writing to console unless stderr-specific redirect used (e.g. "2>"). Ruby 2.6.10 performs as expected:

> ruby bugtest.rb
stdout
stderr
> ruby bugtest.rb > bugtest.txt
stderr
> cat .\bugtest.txt
stdout

Actual Behavior
JRuby redirects both streams to file (removed --enable-native-access=org.jruby.dist warnings from output):

> jruby bugtest.rb
stdout
stderr
> jruby bugtest.rb > bugtestjruby.txt
> cat bugtestjruby.txt
stdout
stderr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions