* [PATCH] terminal: Support old tmux version (<1.9) when querying height value @ 2015-11-03 22:34 leonardo.sandoval.gonzalez 2015-11-03 23:58 ` Dan McGregor 2015-11-05 19:57 ` Leonardo Sandoval 0 siblings, 2 replies; 6+ messages in thread From: leonardo.sandoval.gonzalez @ 2015-11-03 22:34 UTC (permalink / raw) To: openembedded-core; +Cc: benoit.rapidel+yocto 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: -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] terminal: Support old tmux version (<1.9) when querying height value 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 19:57 ` Leonardo Sandoval 1 sibling, 1 reply; 6+ messages in thread From: Dan McGregor @ 2015-11-03 23:58 UTC (permalink / raw) To: leonardo.sandoval.gonzalez Cc: benoit.rapidel+yocto, Patches and discussions about the oe-core layer On 3 November 2015 at 16:34, <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. Yeah, I noticed this shortly after I submitted the fix for 1.9 but didn't think much of it. What system are you using that has 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: > -- > 1.7.10.4 > > -- > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] terminal: Support old tmux version (<1.9) when querying height value 2015-11-03 23:58 ` Dan McGregor @ 2015-11-05 17:44 ` Leonardo Sandoval 2015-11-05 18:07 ` [OE-core] " Benoit Rapidel 0 siblings, 1 reply; 6+ messages in thread From: Leonardo Sandoval @ 2015-11-05 17:44 UTC (permalink / raw) To: Dan McGregor Cc: benoit.rapidel+yocto, Patches and discussions about the oe-core layer On 11/03/2015 05:58 PM, Dan McGregor wrote: > On 3 November 2015 at 16:34, > <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. > > Yeah, I noticed this shortly after I submitted the fix for 1.9 but > didn't think much of it. What system are you using that has tmux 1.6? > debian wheezy. Benoit, can you report the issues you are seeing on tmux1.9 and the tmux output from the -F commands? Seems than when n-panes are open, we get n outputs so clearly calling int() is not enough, so current solution just works when n=1 >> >> 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: >> -- >> 1.7.10.4 >> >> -- >> _______________________________________________ >> Openembedded-core mailing list >> Openembedded-core@lists.openembedded.org >> http://lists.openembedded.org/mailman/listinfo/openembedded-core ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [OE-core] [PATCH] terminal: Support old tmux version (<1.9) when querying height value 2015-11-05 17:44 ` Leonardo Sandoval @ 2015-11-05 18:07 ` Benoit Rapidel 0 siblings, 0 replies; 6+ messages in thread From: Benoit Rapidel @ 2015-11-05 18:07 UTC (permalink / raw) To: yocto As you said on Wheezy, tmux 1.6 the patch provided only works when the windows has 1 pane. If a window has multiple panes, then we got: $ tmux list-panes -F "#{?pane_active,yes,no}" yes no no no $ tmux list-panes -F "#{pane_height}" 43 48 49 43 This leads to: In [2]: import subprocess as sub In [3]: p = sub.Popen('tmux list-panes -F "#{?pane_active,yes,no}"', shell=True, stdout=sub.PIPE,stderr=sub.PIPE) In [4]: out, err = p.communicate() In [5]: out Out[5]: 'yes\nno\nno\nno\nno\n' In [6]: p = sub.Popen('tmux list-panes -F "#{pane_height}"', shell=True, stdout=sub.PIPE,stderr=sub.PIPE) In [7]: out, err = p.communicate() In [8]: out Out[8]: '48\n24\n23\n47\n47\n' In [9]: Note: this only affect tmux 1.6 as tmux 1.9 support -F "#{?pane_active,#{pane_height},}" B. Le 05/11/2015 18:44, Leonardo Sandoval a écrit : > > > On 11/03/2015 05:58 PM, Dan McGregor wrote: >> On 3 November 2015 at 16:34, >> <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. >> >> Yeah, I noticed this shortly after I submitted the fix for 1.9 but >> didn't think much of it. What system are you using that has tmux 1.6? >> > > debian wheezy. > > Benoit, can you report the issues you are seeing on tmux1.9 and the tmux output from > the -F commands? > > Seems than when n-panes are open, we get n outputs so clearly calling int() is not > enough, so current solution just works when n=1 > > >>> >>> 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: >>> -- >>> 1.7.10.4 >>> >>> -- >>> _______________________________________________ >>> Openembedded-core mailing list >>> Openembedded-core@lists.openembedded.org >>> http://lists.openembedded.org/mailman/listinfo/openembedded-core -- Benoit Rapidel Co-founder & CTO at ExMachina ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] terminal: Support old tmux version (<1.9) when querying height value 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 19:57 ` Leonardo Sandoval 2015-11-11 22:35 ` Aws Ismail 1 sibling, 1 reply; 6+ messages in thread From: Leonardo Sandoval @ 2015-11-05 19:57 UTC (permalink / raw) To: openembedded-core; +Cc: benoit.rapidel+yocto 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: > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] terminal: Support old tmux version (<1.9) when querying height value 2015-11-05 19:57 ` Leonardo Sandoval @ 2015-11-11 22:35 ` Aws Ismail 0 siblings, 0 replies; 6+ messages in thread From: Aws Ismail @ 2015-11-11 22:35 UTC (permalink / raw) To: Leonardo Sandoval; +Cc: benoit.rapidel+yocto, openembedded-core I have verified that the patch does not work. I am using tmux v1.8 with the latest jethro poky. On Thu, Nov 5, 2015 at 2:57 PM, Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> wrote: > 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: >> > -- > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-11 22:35 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2015-11-11 22:35 ` Aws Ismail
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.