IO#reopen bug in 1.8.4?

J

Jason Clinton

--nextPart4770210.vPGWEgSv9n
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Greetings list,

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

Shouldn't that last line evaluate to 1?

BTW, it does indeed redirect STDERR to STDOUT, it's just that the #fileno=20
appears to be wrong.


--nextPart4770210.vPGWEgSv9n
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBD6MzLtSqjk42zvwkRAtNSAJ98SuJiSVAoK+Xw6h9jvWxve67/YQCfV1u6
saE8VbQTepxzHu9PYsNVrV0=
=vAh3
-----END PGP SIGNATURE-----

--nextPart4770210.vPGWEgSv9n--
 
A

ara.t.howard

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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top