-/* $OpenBSD: cmd-respawn-pane.c,v 1.24 2017/04/22 10:22:39 nicm Exp $ */
+/* $OpenBSD: cmd-respawn-pane.c,v 1.25 2017/04/25 15:35:10 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
if (envent != NULL)
path = envent->value;
- env = environ_for_session(s);
+ env = environ_for_session(s, 0);
if (window_pane_spawn(wp, args->argc, args->argv, path, NULL, NULL, env,
s->tio, &cause) != 0) {
cmdq_error(item, "respawn pane failed: %s", cause);
-/* $OpenBSD: cmd-respawn-window.c,v 1.34 2017/04/22 10:22:39 nicm Exp $ */
+/* $OpenBSD: cmd-respawn-window.c,v 1.35 2017/04/25 15:35:10 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
if (envent != NULL)
path = envent->value;
- env = environ_for_session(s);
+ env = environ_for_session(s, 0);
if (window_pane_spawn(wp, args->argc, args->argv, path, NULL, NULL, env,
s->tio, &cause) != 0) {
cmdq_error(item, "respawn window failed: %s", cause);
-/* $OpenBSD: cmd-split-window.c,v 1.83 2017/04/22 10:22:39 nicm Exp $ */
+/* $OpenBSD: cmd-split-window.c,v 1.84 2017/04/25 15:35:10 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
if (envent != NULL)
path = envent->value;
- env = environ_for_session(s);
+ env = environ_for_session(s, 0);
if (window_pane_spawn(new_wp, argc, argv, path, shell, cwd, env,
s->tio, &cause) != 0) {
environ_free(env);
-/* $OpenBSD: environ.c,v 1.18 2017/03/09 17:02:38 nicm Exp $ */
+/* $OpenBSD: environ.c,v 1.19 2017/04/25 15:35:10 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
/* Create initial environment for new child. */
struct environ *
-environ_for_session(struct session *s)
+environ_for_session(struct session *s, int no_TERM)
{
struct environ *env;
const char *value;
if (s != NULL)
environ_copy(s->environ, env);
- value = options_get_string(global_options, "default-terminal");
- environ_set(env, "TERM", "%s", value);
+ if (!no_TERM) {
+ value = options_get_string(global_options, "default-terminal");
+ environ_set(env, "TERM", "%s", value);
+ }
if (s != NULL)
idx = s->id;
-/* $OpenBSD: job.c,v 1.43 2017/04/20 09:20:22 nicm Exp $ */
+/* $OpenBSD: job.c,v 1.44 2017/04/25 15:35:10 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, out) != 0)
return (NULL);
- env = environ_for_session(s);
+ /*
+ * Do not set TERM during .tmux.conf, it is nice to be able to use
+ * if-shell to decide on default-terminal based on outside TERM.
+ */
+ env = environ_for_session(s, !cfg_finished);
+
switch (pid = fork()) {
case -1:
environ_free(env);
-/* $OpenBSD: session.c,v 1.73 2017/03/09 17:02:38 nicm Exp $ */
+/* $OpenBSD: session.c,v 1.74 2017/04/25 15:35:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
shell = _PATH_BSHELL;
hlimit = options_get_number(s->options, "history-limit");
- env = environ_for_session(s);
+ env = environ_for_session(s, 0);
w = window_create_spawn(name, argc, argv, path, shell, cwd, env, s->tio,
s->sx, s->sy, hlimit, cause);
if (w == NULL) {
-/* $OpenBSD: tmux.h,v 1.751 2017/04/22 10:22:39 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.752 2017/04/25 15:35:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
void environ_update(struct options *, struct environ *, struct environ *);
void environ_push(struct environ *);
void environ_log(struct environ *, const char *);
-struct environ *environ_for_session(struct session *);
+struct environ *environ_for_session(struct session *, int);
/* tty.c */
void tty_create_log(void);