From 26540613501dbe2e750b1668c3354b20eccb78d6 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 20 Jun 2011 09:14:00 -0400 Subject: [PATCH] clean up lsof on both OSes --- lib/guard/rails/runner.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/guard/rails/runner.rb b/lib/guard/rails/runner.rb index 27bcc78..34c10c6 100644 --- a/lib/guard/rails/runner.rb +++ b/lib/guard/rails/runner.rb @@ -74,14 +74,8 @@ module Guard end def unmanaged_pid - pid_command = - case RbConfig::CONFIG['host_os'] - when /darwin/i - 'lsof -P' - when /linux/i - "lsof -i :#{options[:port]}" - end - %x{#{pid_command}}.each_line { |line| + pid_command = "lsof -n -i TCP:#{options[:port]}" + %x{pid_command}.each_line { |line| if line["*:#{options[:port]} "] return line.split("\s")[1] end