JH> I've been trying to redirect the output of commands invoked by
JH> "system", by changing the $stdout variable in Ruby.

This appears to work:

$saved_stdout = $stdout.dup 
$stdout = File.open("log-file", "w") 
system "echo After redirect, to log-file I hope." 
$stdout = $saved_stdout.dup 
system "echo Original restored, to STDOUT I hope." 

I'm not sure why that second "dup" is necessary, perhaps a guru can
elaborate or give a better solution.

regards,
-joe