Sha256: 2916e4fee4178bf6b68782ac6d82f096323ce903b0a8aabb1fd9768e1fd15455

Contents?: true

Size: 788 Bytes

Versions: 10

Compression:

Stored size: 788 Bytes

Contents

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)
      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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
p4util-0.4.2 ./lib/commands/kill.rb
p4util-0.4.1 ./lib/commands/kill.rb
p4util-0.4 ./lib/commands/kill.rb
p4util-0.3.1 ./lib/commands/kill.rb
p4util-0.3.0 ./lib/commands/kill.rb
p4util-0.2 ./lib/commands/kill.rb
p4util-0.1.6 ./lib/commands/kill.rb
p4util-0.1.5 ./lib/commands/kill.rb
p4util-0.1.4 ./lib/commands/kill.rb
p4util-0.1.3 ./lib/commands/kill.rb