All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Cc: benoit.rapidel+yocto@exmachina.fr
Subject: Re: [PATCH] terminal: Support old tmux version (<1.9) when querying height value
Date: Thu, 05 Nov 2015 13:57:22 -0600	[thread overview]
Message-ID: <563BB4A2.3020800@linux.intel.com> (raw)
In-Reply-To: <1446590054-31188-1-git-send-email-leonardo.sandoval.gonzalez@linux.intel.com>

This patch did not solve the case when multiple panes are present. I 
will send a V2 patch.


On 11/03/2015 04:34 PM, leonardo.sandoval.gonzalez@linux.intel.com wrote:
> From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
>
> Old tmux version (< 1.9) does not support nested formats on the -F parameter, so
> if nested format does not give any answer, do the query in two steps.
>
> Tested on tmux 1.6.
>
> Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
> ---
>   meta/lib/oe/terminal.py |   15 ++++++++++++++-
>   1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
> index 52a8913..686b1ce 100644
> --- a/meta/lib/oe/terminal.py
> +++ b/meta/lib/oe/terminal.py
> @@ -218,11 +218,24 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
>
>   def check_tmux_pane_size(tmux):
>       import subprocess as sub
> +    size = 0
>       try:
>           p = sub.Popen('%s list-panes -F "#{?pane_active,#{pane_height},}"' % tmux,
>                   shell=True,stdout=sub.PIPE,stderr=sub.PIPE)
>           out, err = p.communicate()
> -        size = int(out.strip())
> +        try:
> +            size = int(out.strip())
> +        except ValueError:
> +            # Older tmux versions (< 1.9) does not support nested formats,
> +            # so try it in two steps
> +            p = sub.Popen('%s list-panes -F "#{?pane_active,yes,no}"' % tmux,
> +                shell=True,stdout=sub.PIPE,stderr=sub.PIPE)
> +            out, err = p.communicate()
> +            if "yes" in out.strip():
> +                p = sub.Popen('%s list-panes -F "#{pane_height}"' % tmux,
> +                              shell=True,stdout=sub.PIPE,stderr=sub.PIPE)
> +                out, err = p.communicate()
> +                size = int(out.strip())
>       except OSError as exc:
>           import errno
>           if exc.errno == errno.ENOENT:
>


  parent reply	other threads:[~2015-11-05 19:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 22:34 [PATCH] terminal: Support old tmux version (<1.9) when querying height value leonardo.sandoval.gonzalez
2015-11-03 23:58 ` Dan McGregor
2015-11-05 17:44   ` Leonardo Sandoval
2015-11-05 18:07     ` [OE-core] " Benoit Rapidel
2015-11-05 19:57 ` Leonardo Sandoval [this message]
2015-11-11 22:35   ` Aws Ismail

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=563BB4A2.3020800@linux.intel.com \
    --to=leonardo.sandoval.gonzalez@linux.intel.com \
    --cc=benoit.rapidel+yocto@exmachina.fr \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.