lib/silver_spurs/asyncifier.rb in silver_spurs-2.0.0.rc1 vs lib/silver_spurs/asyncifier.rb in silver_spurs-2.0.0.rc3
- old
+ new
@@ -36,10 +36,15 @@
def has_lock?(process_name)
return false unless File.exists? pid_file_path(process_name)
pid = File.read(pid_file_path(process_name)).to_i
- IO.popen("ps -o command -p #{pid}").read.split("\n").count == 2
+
+ ps_handle = IO.popen("ps -o command -p #{pid}")
+ process_is_running = ps_handle.read.split("\n").count == 2
+ ps_handle.close
+
+ process_is_running
end
def success?(process_name)
return false unless File.exists? success_file_path(process_name)
return true unless File.exists? pid_file_path(process_name)