Aria Stewart
10/25/2007 9:28:00 PM
On Oct 25, 2007, at 7:25 AM, Arul hari wrote:
> Fish Man wrote:
>> Hi,
>> if I start a process in Ruby using the system("some process")
>> how can I get the process id of the process I've just started?
>>
>> Cheers.
>> Dan.
>
> Dear Fish Man,
> This is very simple.Just you can use Process.pid.
> For instance,
> I wll give some example,
> I am having one file:
> 1.rb
> system("ps") =>execute the process
> p Process.pid =>it will tell the current process Id.
But not the one launched by system.
You probably want to use something other than system -- popen, fork/
exec, something like that