From: Tom Gilbert Date: 2002-07-24T23:13:23+09:00 Subject: Re: Can I get data back from a fork? * Jim Freeze (jfreeze@freebsdportal.com) wrote: > On Wed, Jul 24, 2002 at 10:59:15PM +0900, ts wrote: > > >>>>> "J" == Jim Freeze writes: > > > > >> job.pid = Process.fork { redirect(job) } > > > > job is created in a process > > > > >> def redirect(job) > > >> job.result = system(job.cmd) #=> job.result has a value here > > > > you modify `job' in *another* process > > > > >> job.result #=> job.result is empty. Why? > > > > you retrieve the value that was assigned in the initial process > > > > `job' is not a shared variable > > > Another question. Do you know of a simple way to propagate data back > to the original process? Sure, spit out the data on stdout and have the parent read it back in :) Tom. -- .^. .-------------------------------------------------------. /V\ | Tom Gilbert, London, England | http://linuxbrit.co.uk | /( )\ | Open Source/UNIX consultant | tom@linuxbrit.co.uk | ^^-^^ `-------------------------------------------------------'