summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-06-28 22:10:43 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-06-28 22:10:43 +0000
commite2546c0ed9de9f453c28d13893e7cab5f97e212b (patch)
tree05e2c0153fb03a1137f4c1df6e27e61e2c0c45cb /usr.bin/tmux/client.c
parentd2110dd96b54c8e81d65079f4e4d10ceebf630c5 (diff)
Send all three of stdin, stdout, stderr from the client to the server, so that
commands can directly make use of them. This means that load-buffer and save-buffer can have "-" as the file to read from stdin or write to stdout. This is a protocol version bump so the tmux server will need to be restarted after upgrade (or an older client used).
Diffstat (limited to 'usr.bin/tmux/client.c')
-rw-r--r--usr.bin/tmux/client.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c
index 66a85dcd8f8..943f5bbac61 100644
--- a/usr.bin/tmux/client.c
+++ b/usr.bin/tmux/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.41 2010/06/05 16:47:11 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.42 2010/06/28 22:10:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -96,8 +96,7 @@ server_started:
if (cmdflags & CMD_SENDENVIRON)
client_send_environ();
- if (isatty(STDIN_FILENO))
- client_send_identify(flags);
+ client_send_identify(flags);
return (&client_ibuf);
@@ -131,6 +130,14 @@ client_send_identify(int flags)
fatal("dup failed");
imsg_compose(&client_ibuf,
MSG_IDENTIFY, PROTOCOL_VERSION, -1, fd, &data, sizeof data);
+
+ if ((fd = dup(STDOUT_FILENO)) == -1)
+ fatal("dup failed");
+ imsg_compose(&client_ibuf, MSG_STDOUT, PROTOCOL_VERSION, -1, fd, NULL, 0);
+
+ if ((fd = dup(STDERR_FILENO)) == -1)
+ fatal("dup failed");
+ imsg_compose(&client_ibuf, MSG_STDERR, PROTOCOL_VERSION, -1, fd, NULL, 0);
}
void