From: ahoward@... (ara howard) Date: 2002-08-20T05:09:00+09:00 Subject: 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 : #!/usr/bin/env ruby require 'delegate' $errlog0 = open 'errlog0', 'w' $errlog1 = open 'errlog1', 'w' ############################################# # TEST ZERO ############################################# class DupIO < SimpleDelegator def initialize io super io end end $stderr = DupIO.new $errlog0 puts "RUNNING TEST ZERO" $stderr.puts 'this is redirected into errlog' # this is NOT!!! `ls some/command/which/produces/stderr` ############################################# # TEST ONE ############################################# $stderr = $errlog1 puts "RUNNING TEST ONE" $stderr.puts 'this is redirected into errlog' # this is TOO!!! `ls some/command/which/produces/stderr` ----- in TEST ZERO it seems the global variable $stderr has NO impact on a spawned subprocess, yet in TEST ONE is certainly does?? can anyone shed light on this? -ara howard ahoward@fsl.noaa.gov