Forum: Ruby IO#reopen bug in 1.8.4?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0ce41464080e3a3e337ad7463ce1e2fe?d=identicon&s=25 Jason Clinton (Guest)
on 2006-02-07 17:39
(Received via mailing list)
Greetings list,

$stdout.fileno => 1
$stderr.fileno => 2
$stderr.reopen($stdout)
$stderr.fileno => 2

Shouldn't that last line evaluate to 1?

BTW, it does indeed redirect STDERR to STDOUT, it's just that the
#fileno
appears to be wrong.
Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 unknown (Guest)
on 2006-02-07 17:57
(Received via mailing list)
On Wed, 8 Feb 2006, Jason Clinton wrote:

> appears to be wrong.
i think it's ok


     harp:~ > strace ruby -e'  STDERR.reopen STDOUT  ' 2>&1| tail
     rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
     geteuid32()                             = 447
     getegid32()                             = 447
     getuid32()                              = 447
     geteuid32()                             = 447
     getgid32()                              = 447
     getegid32()                             = 447
     dup2(1, 2)                              = 2
     rt_sigaction(SIGINT, {SIG_DFL}, {0x80a1ff4, [],
SA_RESTORER|SA_RESTART, 0x3710d8}, 8) = 0
     exit_group(0)                           = ?


so all that's happening is a dup2.  in that case there should in fact be
two
fds (fileno).

regards.

-a
This topic is locked and can not be replied to.