Sha256: 5c62e4b99aab98efa71a3467c6eb35ad1d1b875cbde1636d5a7f4bb768508edc
Contents?: true
Size: 710 Bytes
Versions: 22
Compression:
Stored size: 710 Bytes
Contents
class KuberKit::Shell::Commands::SystemCommands def kill_process(shell, pid) # we need to use kill command directly sometimes, # because Process.kill doesn't kill processes created by system() call shell.exec!("kill -9 #{pid}", merge_stderr: true) true rescue false end def find_pids_by_name(shell, name) shell .exec!("ps auxww | grep '#{name}' | grep -v 'grep' | awk '{print $2}'") .split("\n") .reject(&:empty?) .map(&:chomp) .map(&:to_i) rescue [] end def get_child_pids(shell, pid) shell .exec!("pgrep -P #{pid}") .split("\n") .reject(&:empty?) .map(&:chomp) .map(&:to_i) rescue [] end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
kuber_kit-1.1.2 | lib/kuber_kit/shell/commands/system_commands.rb |
kuber_kit-1.2.1 | lib/kuber_kit/shell/commands/system_commands.rb |