Sha256: c31d7f464772522cd4029f422d3779e0fa65b579bdb8472865217115482bac1b

Contents?: true

Size: 297 Bytes

Versions: 3

Compression:

Stored size: 297 Bytes

Contents

module RoCommands
  class Processes < Base
    desc 'kill KEYWORD', 'kill process with keyword'
    def kill(keyword)
      `ps aux | grep #{keyword}`.split("\n").each do |process|
        puts process
        pid = process.scan(/\d+/).first
        bash "kill #{pid}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ro_commands-0.0.3 lib/ro_commands/processes.rb
ro_commands-0.0.2 lib/ro_commands/processes.rb
ro_commands-0.0.1 lib/ro_commands/processes.rb