commit 9a8ef267698df311546ad7e9621800379c78534c parent 204f906b057c985cd905e820995c9a87c18d884b Author: Suraj N. Kurapati <sunaku@gmail.com> Date: Wed, 27 Sep 2006 20:43:08 -0700 [project @ 03085b759dabe696e347e0b46e3bf873baccd352] another better way to write the code Diffstat:
wmiirc | | | 10 | ++++------ |
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/wmiirc b/wmiirc @@ -35,13 +35,11 @@ end LOG = Logger.new(__FILE__ + '.log', 5) LOG.info "starting" -# terminate existing instances - pidList = `ps -C #{File.basename $0} -o pid`. - split[1..-1]. # discard header from `ps` output +# terminate existing instances of this program + `ps -C #{File.basename $0} -o pid h`.split. map! {|s| s.to_i}. - reject! {|pid| pid == $$} - - pidList.each do |pid| + reject! {|pid| pid == $$}. + each do |pid| LOG.info "stopping loader #{pid}" Process.kill :SIGTERM, pid end