Closes Homebrew/homebrew#15446.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
David Goodlad 2012-10-14 08:45:29 +11:00 committed by Adam Vandenberg
parent 5682517724
commit 6b84d129c8

View file

@ -2,8 +2,8 @@ require 'formula'
class Tmux < Formula
homepage 'http://tmux.sourceforge.net'
url 'http://sourceforge.net/projects/tmux/files/tmux/tmux-1.6/tmux-1.6.tar.gz'
sha1 '8756f6bcecb18102b87e5d6f5952ba2541f68ed3'
url 'http://sourceforge.net/projects/tmux/files/tmux/tmux-1.7/tmux-1.7.tar.gz'
sha1 'ee6942a1bc3fc650036f26921d80bc4b73d56df6'
head 'git://tmux.git.sourceforge.net/gitroot/tmux/tmux'
@ -15,21 +15,6 @@ class Tmux < Formula
depends_on :libtool
end
def patches
p = []
if build.stable?
# Fix for Japanese characters. (Does not apply to head.) See:
# http://sourceforge.net/tracker/?func=detail&aid=3566884&group_id=200378&atid=973264
p << 'http://sourceforge.net/tracker/download.php?group_id=200378&atid=973264&file_id=453002&aid=3566884'
# This patch adds the implementation of osdep_get_cwd for Darwin platform,
# so that tmux can get current working directory correctly under Mac OS.
# NOTE: it applies to 1.6 only, and should be removed when 1.7 is out.
# (because it has been merged upstream)
p << DATA
end
p
end
def install
system "sh", "autogen.sh" if build.head?
@ -56,31 +41,3 @@ class Tmux < Formula
end
end
__END__
diff --git a/osdep-darwin.c b/osdep-darwin.c
index c5820df..7b15446 100644
--- a/osdep-darwin.c
+++ b/osdep-darwin.c
@@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/sysctl.h>
+#include <libproc.h>
#include <event.h>
#include <stdlib.h>
@@ -52,6 +53,15 @@
char *
osdep_get_cwd(pid_t pid)
{
+ static char wd[PATH_MAX];
+ struct proc_vnodepathinfo pathinfo;
+ int ret;
+
+ ret = proc_pidinfo(pid, PROC_PIDVNODEPATHINFO, 0, &pathinfo, sizeof(pathinfo));
+ if (ret == sizeof(pathinfo)) {
+ strlcpy(wd, pathinfo.pvi_cdir.vip_path, sizeof(wd));
+ return (wd);
+ }
return (NULL);
}