From: Mike Barsalou Date: 2009-08-25T07:50:06+09:00 Subject: Re: Asynchronous process to process pipe IO On Aug 24, 1:05 pm, Gary Wright wrote: > On Aug 24, 2009, at 4:54 PM, Pito Salas wrote: > > > > > Now, I am not exactly clear (reading the doc) about the difference > > between exec and system... I do need to be able to send command line > > arguments to iacommand.rb and I do indeed need to process the output   > > 'as > > it appears.' > > exec() causes a new program to be executed within the current process. > Unless exec() fails (e.g. program not found), exec() will never 'return' > because the current program will be discarded (i.e. the Ruby   > interpreter) > in favor of the newly exec'ed one. > > system() causes a new (child) process to be created and for the new > program to be executed (i.e. exec'ed) within the new child process. > The current process will wait for the child process to terminate before > proceeding. > > The difference is whether the new program replaces the currently > running program or not. Note that 'program' here means the Ruby > interpreter and not the particular Ruby script that is running. > > Note: I'm answering from the perspective of a Unix/Posix environment. > My windows-fu isn't sufficient to say if my description is correct > for that environment, but it is probably pretty close. > > Gary Wright Would Ruby's fork behave exactly like system here, or would it have a third path? Likely fork wouldn't be an option for the OP because he wants to process the output? Mike B.