Sha256: b1d05989f240588567a6e5c5e20fe99d67f145e536c99e269d1d8d1c275c1a63
Contents?: true
Size: 690 Bytes
Versions: 43
Compression:
Stored size: 690 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}") 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
43 entries across 43 versions & 1 rubygems