mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-18 01:20:17 +02:00
Change the way the working directory for new processes is discovered. If
default-path isn't empty, it is used. Otherwise: 1) If tmux neww is run from the command line, the working directory of the client is used. 2) Otherwise use some platform specific code to retrieve the current working directory of the process in the active pane. 3) If that fails, the directory where the session was created is used. Idea and support code, Linux, Solaris, FreeBSD bits by Romain Francoise, OpenBSD bits by me.
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
|
||||
struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *);
|
||||
char *osdep_get_name(int, char *);
|
||||
char *osdep_get_cwd(pid_t);
|
||||
struct event_base *osdep_event_init(void);
|
||||
|
||||
struct kinfo_proc *
|
||||
@@ -133,6 +134,18 @@ error:
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
char*
|
||||
osdep_get_cwd(pid_t pid)
|
||||
{
|
||||
int name[] = { CTL_KERN, KERN_PROC_CWD, (int)pid };
|
||||
static char path[MAXPATHLEN];
|
||||
size_t pathlen = sizeof path;
|
||||
|
||||
if (sysctl(name, 3, path, &pathlen, NULL, 0) != 0)
|
||||
return (NULL);
|
||||
return (path);
|
||||
}
|
||||
|
||||
struct event_base *
|
||||
osdep_event_init(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user