Skip to content

Redirecting $stdout to an object fails with: Errno::EBADF: Bad file descriptor - Bad file descriptor #2373

@headius

Description

@headius

From http://jira.codehaus.org/browse/JRUBY-7051

Note that the given script (at bottom) now produces NPE when run.

What steps will reproduce the problem?
Run the attached script test.rb

What is the expected output? What do you see instead?
I would expect output to be redirected like in MRI.

Additional information

jruby 1.6.7.2
Errno::EBADF: Bad file descriptor - Bad file descriptor
(root) at test.rb:14

jruby 1.6.7.2 --1.9
Errno::EBADF: Bad file descriptor - Bad file descriptor
(root) at test.rb:14

jruby 1.7.1 (1.9.3p327)
Errno::EBADF: Bad file descriptor - Bad file descriptor
(root) at test.rb:14

jruby 1.7.2.dev (1.9.3p327) 2013-01-02 (rvm install jruby-head) fffffff on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-11M3909 [darwin-x86_64]
Errno::EBADF: Bad file descriptor - Bad file descriptor
(root) at test.rb:14

ruby 1.9.3-p194
I, [2013-01-02T14:10:19.076856 #53379] INFO -- : INTERCEPTED: Should be intercepted
I, [2013-01-02T14:10:19.077363 #53379] INFO -- : INTERCEPTED:

Should not be intercepted

ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
I, [2013-01-02T14:14:51.521904 #53685] INFO -- : INTERCEPTED: Should be intercepted
I, [2013-01-02T14:14:51.553957 #53685] INFO -- : INTERCEPTED:

Should not be intercepted

Script from original issue: https://gist.github.com/headius/e0ecd58485e2b4ca4938

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions