Basically I have this method:

@pid = Process.create(
          :app_name       => 'ruby clicker.rb',
          :creation_flags  => Process::DETACHED_PROCESS
          ).process_id
          at_exit{ Process.kill(9,@pid) }

which I think creating this process, but somehow at_exit is not
working.



On Mar 15, 11:07 am, Shlomit Gazit <shlomitpatr...@gmail.com> wrote:
> Hello,
> Thank you.
> Where would you recommend to put this code?
>
> On Mar 15, 2:48 am, rakesh swain <rocky.deb...@gmail.com> wrote:
>
> > Hi,
>
> > Execute the following. The process can be identified and terminated.
>
> > require 'win32ole'
> > require 'win32/process'
>
> >            wmi = WIN32OLE.connect("winmgmts://")
> >            processes = wmi.ExecQuery("select * from Win32_process")
> >            for process in processes do
> >               if process.Name.include? "rubyw.exe" then
> >                  puts "Name: #{process.Name}"
> >                  #~ puts "Process ID: #{process.Pid}"
> >                  puts process.Terminate
> >                  puts "Finished Checking Processess and killing any process
> > Leakage"
> >                 elsif process.Name.include? "anyotherprocess.exe" then
> >                  #~ puts "Name: #{process.Name}"
> >                  #~ puts "Process ID: #{process.Pid}"
> >                  #~ puts process.Terminate
> >               end

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com

Reply via email to