Yes but it'd need to be -c not -t. Try this please. You need -c '' to
get current client.


diff --git a/cmd-show-environment.c b/cmd-show-environment.c
index 2238929..5837c1b 100644
--- a/cmd-show-environment.c
+++ b/cmd-show-environment.c
@@ -31,8 +31,8 @@ enum cmd_retval        cmd_show_environment_exec(struct cmd 
*, struct cmd_q *);
 
 const struct cmd_entry cmd_show_environment_entry = {
        "show-environment", "showenv",
-       "gt:", 0, 1,
-       "[-g] " CMD_TARGET_SESSION_USAGE " [name]",
+       "gc:t:", 0, 1,
+       "[-g] [-c target-client] " CMD_TARGET_SESSION_USAGE " [name]",
        0,
        NULL,
        cmd_show_environment_exec
@@ -42,14 +42,21 @@ enum cmd_retval
 cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq)
 {
        struct args             *args = self->args;
+       struct client           *c;
        struct session          *s;
        struct environ          *env;
        struct environ_entry    *envent;
 
        if (args_has(self->args, 'g'))
                env = &global_environ;
-       else {
-               if ((s = cmd_find_session(cmdq, args_get(args, 't'), 0)) == 
NULL)
+       else if (args_has(self->args, 'c')) {
+               c = cmd_find_client(cmdq, args_get(args, 'c'), 0);
+               if (c == NULL)
+                       return (CMD_RETURN_ERROR);
+               env = &c->environ;
+       } else {
+               s = cmd_find_session(cmdq, args_get(args, 't'), 0);
+               if (s == NULL)
                        return (CMD_RETURN_ERROR);
                env = &s->environ;
        }
diff --git a/cmd.c b/cmd.c
index f2d88c0..a13ee11 100644
--- a/cmd.c
+++ b/cmd.c
@@ -486,7 +486,7 @@ cmd_find_client(struct cmd_q *cmdq, const char *arg, int 
quiet)
        size_t           arglen;
 
        /* A NULL argument means the current client. */
-       if (arg == NULL) {
+       if (arg == NULL || *arg == '\0') {
                c = cmd_current_client(cmdq);
                if (c == NULL && !quiet)
                        cmdq_error(cmdq, "no clients");





On Fri, Apr 25, 2014 at 08:36:16AM +0530, Vardhan Varma wrote:
>    Hi,
>    ** A **search for 'tmux SSH_AUTH_SOCK' brings up about 8000 pages of
>    hacked up scripts.
>    ** **
>    **The solution can be simpler if one can just do something like:
>    ** ** ** $ export SSH_AUTH_SOCK=$(tmux show-environment -t
>    <current-client> SSH_AUTH_SOCK)
>    ** where **'<current-client>' is some way to refer to current client,
>    ** and '-t target-client' is some new flag to show-environment to access
>    client's environment.
>    ** To me more clear, this '-t target-client' should make the 'tmux server'
>    request the environment
>    ** from the 'tmux client' attached to that tty. This **'client tmux'
>    process will be a child of the**
>    ** sshd, and hence have the correct SSH_AUTH_SOCK.
>    ** Makes senses ? Doable ?
>    **
>    --
>    Regards

> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform

> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to