Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread
Message: 96424
BY: Lonnie Warpup (lwwarpup)
DATE: 2011-05-03 16:20
SUBJECT: Process.kill(0, {pid}) on Windows Server 2008

 

I have a scheduler application in which the job being run is using the Process.create tool and then monitoring the pid of the created process with the Process.kill(0, pid) method. This is working on some of our Windows servers, but it seems to be failing on our Windows Server 2008 box.

The code block is as follows:

@process = Process.create(:app_name => "cmd.exe /C ...")

# Loop until process has died
begin
Process.kill(0, @process.process_id)
sleep 5
rescue
break
end while true

What I am expecting is for the Process.kill method to return an array with the pid as its sole value, or raise an error if the process has completed. It is currently ALWAYS returning the array even after the process has completed currently.

I would LIKE to use Process.waitpid, but since this code is a Ruby thread, Process.waitpid is locking all the threads.

Is there something I could be doing better?


Thread View

Thread Author Date
Process.kill(0, {pid}) on Windows Server 2008Lonnie Warpup2011-05-03 16:20
      RE: Process.kill(0, {pid}) on Windows Server 2008Lonnie Warpup2011-05-03 16:40

Post a followup to this message