Jim Freeze schrieb:
> Is there a way to get data back from a fork?
[codesnippet]
> I want to be able to store the result status from the system
> call, but setting it inside redirect does not seem to work.
> I checked and the objects have the same id, so I am
> not sure why I can't set the result status.

It is because the objects live in two different 
processes, as this is the meaning of fork.

To interchange information between this two
processes you have to create a interprocess 
communication, normally via pipes.

Look in the pickaxe at  IO#pipe
(Ch. 22, Built-in classes)

there you can find the following example:

rd, wr = IO.pipe

if fork
   wr.close
   puts "Parent got: <#{rd.read}>"
   rd.close
   Process.wait
else
   rd.close
   puts "Sending message to parent"
   wr.write "Hi Dad"
   wr.close
end

the parent process receives the 
child process id as result of fork and
goes into the 'then' branch.
The child process receives nil as
result of the fork and goes into
the 'else' branch.

because of the first line 
   rd, wr = IO.pipe

the two processes use the created pipe
the parent closes the writer first,
the child closes the reader.
(for details see the pickaxe paragraph).

then the child writes "Hi Dad" into the
pipe which is read by the parent.

HTH

Det