Hello tmux users and developers! I found an interesting issue on tmux 1.7. I have the following snippet at the end of my tmux.conf:
if-shell "[[ -e ~/.tmux.local.conf ]]" \
"source-file ~/.tmux.local.conf"
In tmux.local.conf, I set certain environment variables, depending on
the machine.
However, when I start up the tmux server process by using new-session,
the environment variables are not correctly set. This is because the
if-shell job is still running in the background when the session is
created.
Attached is a patch to fix this; please let me know if there's anything
I can do to improve it!
Thanks,
Rob
diff --git a/server.c b/server.c
index 4da0739..60b0bc1 100644
--- a/server.c
+++ b/server.c
@@ -110,6 +110,7 @@ server_start(int lockfd, char *lockfile)
char *cause;
struct timeval tv;
u_int i;
+ char dummy;
/* The first client is special and gets a socketpair; create it. */
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pair) != 0)
@@ -122,6 +123,7 @@ server_start(int lockfd, char *lockfile)
break;
default:
close(pair[1]);
+ read(pair[0], &dummy, 1);
return (pair[0]);
}
close(pair[0]);
@@ -200,22 +202,33 @@ server_start(int lockfd, char *lockfile)
evtimer_add(&server_ev_second, &tv);
set_signals(server_signal_callback);
+ /* wait for any jobs started by the configuration file to finish */
+ while(!LIST_EMPTY(&all_jobs) && !server_should_shutdown()) {
+ server_loop_once();
+ }
+ write(pair[1], "a", 1);
server_loop();
exit(0);
}
+void
+server_loop_once(void)
+{
+ event_loop(EVLOOP_ONCE);
+
+ server_window_loop();
+ server_client_loop();
+
+ key_bindings_clean();
+ server_clean_dead();
+}
+
/* Main server loop. */
void
server_loop(void)
{
while (!server_should_shutdown()) {
- event_loop(EVLOOP_ONCE);
-
- server_window_loop();
- server_client_loop();
-
- key_bindings_clean();
- server_clean_dead();
+ server_loop_once();
}
}
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________ tmux-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tmux-users
