October 25th, 2012, 02:08 PM
Beginner Ruby question
I am trying to determine if a process is running or not using this code. What is the right way to do this? Here is my attempt
 pry(main)> if Process.getpgid(89707) !=1
 pry(main)* puts "it got killed"
 pry(main)* else
 pry(main)* puts "it did not get killed"
 pry(main)* end
Errno::ESRCH: No such process
from (pry):1:in `getpgid'
October 28th, 2012, 08:54 AM
When you call - Process.getpgid - it returns the pcocess group id.
Your if statement shoud be
if Process.getpgid != 89707
October 28th, 2012, 09:54 AM
Thank You. Almost obvious now that I see your answer
Originally Posted by G4143
P.S - How do I mark this as answered?