Run job commands explicitly in the global enviroment (which can be

modified with setenv -g) rather than with the environment tmux started
with.
This commit is contained in:
Nicholas Marriott
2010-04-06 21:59:19 +00:00
parent 091db41bc9
commit 0fc65537a3
5 changed files with 56 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.129 2010-04-06 21:58:33 nicm Exp $ */
/* $Id: window.c,v 1.130 2010-04-06 21:59:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -478,14 +478,11 @@ int
window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
const char *cwd, struct environ *env, struct termios *tio, char **cause)
{
struct winsize ws;
int mode;
char *argv0, **varp, *var;
ARRAY_DECL(, char *) varlist;
struct environ_entry *envent;
const char *ptr;
struct termios tio2;
u_int i;
struct winsize ws;
int mode;
char *argv0;
const char *ptr;
struct termios tio2;
if (wp->fd != -1) {
close(wp->fd);
@ -528,20 +525,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
if (tcsetattr(STDIN_FILENO, TCSANOW, &tio2) != 0)
fatal("tcgetattr failed");
ARRAY_INIT(&varlist);
for (varp = environ; *varp != NULL; varp++) {
var = xstrdup(*varp);
var[strcspn(var, "=")] = '\0';
ARRAY_ADD(&varlist, var);
}
for (i = 0; i < ARRAY_LENGTH(&varlist); i++) {
var = ARRAY_ITEM(&varlist, i);
unsetenv(var);
}
RB_FOREACH(envent, environ, env) {
if (envent->value != NULL)
setenv(envent->name, envent->value, 1);
}
environ_push(env);
server_signal_clear();
log_close();