require 'commands/util' module Commands def Commands.kill(options=nil) list_process_names.select{|p| p =~ /p4d/}.each do |p| pid = pid_for_process(p) next if pid.nil? begin puts "killing p4d #{p} at #{pid}" Process.kill('TERM', pid) rescue Exception => e puts "Problem killing #{p}: #{e.message}" puts e.backtrace.join('\n') 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