From: Carlos Date: 2002-08-22T04:44:42+09:00 Subject: Re: inconsistency in shared state between parent/child processes > i am very confused about how/when global state is shared between > parent-child processes in ruby, look at the following : ... > $stderr = DupIO.new $errlog0 ... > # this is NOT!!! > `ls some/command/which/produces/stderr` ... > $stderr = $errlog1 ... > # this is TOO!!! > `ls some/command/which/produces/stderr` Because when you assign $stderr or $stdout to a IO object, Ruby does some magic and dups the file descriptor. But when you assign it to some other object, it only changes the binding of the variable; and everything that goes to stderr or stdout by other meanings than calling methods... well, goes to stderr or stdout.