Eric Schwartz
11/24/2003 7:27:00 PM
"Mark J. Reed" <markjreed@mail.com> writes:
> Or, if you aren't invoking any processes external to ruby, you can leave
> STDOUT alone and just change $stdout:
Okay, this hints at the answer to a question I've been wondering about
for a while now: what's the difference between STDOUT/STDERR/STDIN and
$stdout/$stderr/$stdin?
It seems your message implies that STDOUT/STDERR/STDIN are IO objects
that when changed, the changes are passed on to children, but if you
change $stdout and friends, those changes are not passed on to
children.
If so, this confuses me greatly, since $stdout prints to stdout, and
if open filehandles (including the magic 3) are inherited by children
(as they are on most *nices), then how can I reopen $stdout without
changing stdout? Why is there such a (to me) confusing and needless
distinction?
Of course, if I inferred incorrectly, disregard the previous
paragraph. :)
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.