Skip to content

Instantly share code, notes, and snippets.

@splhack
Created June 3, 2009 13:21
Show Gist options
  • Save splhack/122977 to your computer and use it in GitHub Desktop.
Save splhack/122977 to your computer and use it in GitHub Desktop.
diff --git a/vim/plugin/ruby_debugger.vim b/vim/plugin/ruby_debugger.vim
index d9b1f47..7c838a0 100644
--- a/vim/plugin/ruby_debugger.vim
+++ b/vim/plugin/ruby_debugger.vim
@@ -1464,6 +1464,9 @@ function! s:Server._get_pid_attempt(bind, port)
let netstat = system("netstat -anop tcp")
let pid_match = matchlist(netstat, ':' . a:port . '\s.\{-}LISTENING\s\+\(\d
\+\)')
let pid = len(pid_match) > 0 ? pid_match[1] : ""
+ elseif has("mac")
+ let pid = system("lsof -i tcp:" . a:port . " | grep LISTEN | awk '{print $2
}'")
+ let pid = substitute(pid, '\n', '', '')
elseif executable('lsof')
let pid = system("lsof -i 4tcp@" . a:bind . ':' . a:port . " | grep LISTEN
| awk '{print $2}'")
let pid = substitute(pid, '\n', '', '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment