MiG wrote:

> but still don't know how to redirect stdin/stdout of each script runned
> on server to client's stdin/stdout.

Can't you do something like this?

client_stdin, client_stdout, client_stderr = # Fetch them here over drb
# You might have to use Drb::Undumpable

file = # Fetch over drb
Thread.new do
   $stdin, $stdout, $stderr = client_stdin, client_stdout, client_stderr

   load(file)
end

Of course there's still ARGV, ENV and misc. global variables that can be 
set with Ruby command line options ($DEBUG, $-w...) which you'd also 
need to handle. I think all the globals are scoped on a Thread-base 
which means that they should be easy to do. I suppose that you'd need 
introduce a new Module with custom constants for changing ARGV and so on 
however. (And that still won't work with ::ARGV, but I've never seen 
that used anyway.)

Regards,
Florian Gross