Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/process_management.rb')
-rw-r--r--lib/gitlab/process_management.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gitlab/process_management.rb b/lib/gitlab/process_management.rb
index 2c2aaadb29a..604b6129648 100644
--- a/lib/gitlab/process_management.rb
+++ b/lib/gitlab/process_management.rb
@@ -70,11 +70,17 @@ module Gitlab
end
def self.process_alive?(pid)
+ return false if pid.nil?
+
# Signal 0 tests whether the process exists and we have access to send signals
# but is otherwise a noop (doesn't actually send a signal to the process)
signal(pid, 0)
end
+ def self.process_died?(pid)
+ !process_alive?(pid)
+ end
+
def self.write_pid(path)
File.open(path, 'w') do |handle|
handle.write(Process.pid.to_s)