require 'commands/util' require 'sys/proctable' include Sys module Commands def Commands.kill(options=nil) ProcTable.ps().find_all{|p| p.comm =~ /p4d/}.each do |p| begin Process.kill('TERM', p.pid) rescue puts "Problem killing #{p}, ignoring" end end is_running = true while is_running is_running = p4d_running? if is_running sleep 0.2 end end end def Commands.print_kill_help puts <<-END.gsub(/^ {6}/,'') p4util kill Finds local p4d processes and kills them. On unix machines, will probably use `ps -x` and 'p4d', then will send SIGTERM signals to each process. END end end