when use `cmd` syntax, you still can get the process id of the executed
command.
you can use $?.pid to get that pid, because a Process::Status object of
executed command is stored in $? variables.

2007/10/26, <>:

···

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