lib/bluepill/process.rb in bluepill-0.0.69 vs lib/bluepill/process.rb in bluepill-0.0.70
- old
+ new
@@ -127,11 +127,11 @@
add_watch(name, opts)
end
end
# These defaults are overriden below if it's configured to be something else.
- @monitor_children = false
+ @monitor_children = false
@cache_actual_pid = true
@start_grace_time = @stop_grace_time = @restart_grace_time = 3
@environment = {}
@on_start_timeout = 'start'
@group_start_noblock = @group_stop_noblock = @group_restart_noblock = @group_unmonitor_noblock = true
@@ -230,11 +230,11 @@
thread[:events].each do |event|
events << [event, watch.to_s]
end
end
events
- end.each do |(event, reason)|
+ end.each do |event, reason| # rubocop:disable Style/MultilineBlockChain
break if @transitioned
self.dispatch!(event, reason)
end
end
@@ -284,11 +284,11 @@
if self.daemonize?
daemon_id = System.daemonize(start_command, system_command_options)
if daemon_id
ProcessJournal.append_pid_to_journal(name, daemon_id)
children.each do|child|
- ProcessJournal.append_pid_to_journal(name, child.actual_id)
+ ProcessJournal.append_pid_to_journal(name, child.actual_pid)
end if self.monitor_children?
end
daemon_id
else
# This is a self-daemonizing process
@@ -468,19 +468,19 @@
def refresh_children!
# First prune the list of dead children
@children.delete_if { |child| !child.process_running?(true) }
# Add new found children to the list
- new_children_pids = System.get_children(actual_pid) - @children.map(&:actual_pid)
+ new_children_pids = System.get_children(actual_pid) - @children.collect(&:actual_pid)
unless new_children_pids.empty?
logger.info "Existing children: #{@children.collect(&:actual_pid).join(',')}. Got new children: #{new_children_pids.inspect} for #{actual_pid}"
end
# Construct a new process wrapper for each new found children
new_children_pids.each do |child_pid|
- ProcessJournal.append_pid_to_journal(name, child_pid)
+ ProcessJournal.append_pid_to_journal(name, child_pid) if daemonize?
child_name = "<child(pid:#{child_pid})>"
logger = self.logger.prefix_with(child_name)
child = child_process_factory.create_child_process(child_name, child_pid, logger)
@children << child
@@ -491,18 +491,18 @@
command.to_s.gsub('{{PID}}', actual_pid.to_s)
end
def system_command_options
{
- :uid => uid,
- :gid => gid,
+ :uid => uid,
+ :gid => gid,
:working_dir => working_dir,
:environment => environment,
- :pid_file => pid_file,
- :logger => logger,
- :stdin => stdin,
- :stdout => stdout,
- :stderr => stderr,
+ :pid_file => pid_file,
+ :logger => logger,
+ :stdin => stdin,
+ :stdout => stdout,
+ :stderr => stderr,
:supplementary_groups => supplementary_groups,
}
end
def with_timeout(secs, next_state = nil, &blk)