Skip to contentSkip to conversation

terminal.py: do not stop searching for auto

PATCH In review Joe Slater 3 participants 4 messages May 21, 2020 – May 22, 2020

lore
Share & tools
lore

Joe Slater

author
#0 lore raw

PATCH 1/1 terminal.py: do not stop searching for auto

If a terminal fails to spawn() we should continue looking. gnome-terminal, in particular can be present but not start.

---
 meta/lib/oe/terminal.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta/lib/oe/terminal.py +4 -1
index a1daa2bed6..eb10a6e33e 100644
@@ -207,7 +207,10 @@ def spawn_preferred(sh_cmd, title=None, env=None, d=None):
             spawn(terminal.name, sh_cmd, title, env, d)
             break
         except UnsupportedTerminal:
-            continue
+            pass
+        except:
+            bb.warn("Terminal %s is supported but did not start" % (terminal.name))
+    # when we've run out of options
     else:
         raise NoSupportedTerminals(get_cmd_list())
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 2 lines · Joe Slater

If a terminal fails to spawn() we should continue looking. gnome-terminal, in particular can be present but not start.

Do you mean that it doesn't start on the first try but that it may / usually does start on subsequent tries?

Since the user has set the preferred terminal, this change could confuse them and therefore seems wrong. If we know of flaky terminal implementations, why not look for specific versions, issue a warning and either retry or tell the user to try again? In a few years, we can discard the code when the flaky terminal version is no longer used.

Is there a bug open with gnome-terminal to track this? What distro/gnome-terminal do you see this problem in?

Quoted 13 lines
---
  meta/lib/oe/terminal.py | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
meta/lib/oe/terminal.py +0 -0
index a1daa2bed6..eb10a6e33e 100644
@@ -207,7 +207,10 @@ def spawn_preferred(sh_cmd, title=None, env=None, d=None):
              spawn(terminal.name, sh_cmd, title, env, d)

meta/lib/oe/terminal.py def spawn_preferred(sh_cmd, title=None, env=None, d=None): · line 216

Quoted 10 lines
meta/lib/oe/terminal.py +4 -1
              break
          except UnsupportedTerminal:
-            continue
+            pass
+        except:
+            bb.warn("Terminal %s is supported but did not start" % (terminal.name))
+    # when we've run out of options
      else:
          raise NoSupportedTerminals(get_cmd_list())
 

The full function is:

def spawn_preferred(sh_cmd, title=None, env=None, d=None):
"""Spawn the first supported terminal, by priority""" for terminal in prioritized():
try:
spawn(terminal.name, sh_cmd, title, env, d) break
except UnsupportedTerminal:
continue
else:
raise NoSupportedTerminals(get_cmd_list())

so you'll need to change the doc string if you want to retry 3 times.

Signature · 2 lines
# Randy MacLeod
# Wind River Linux
#2 lore raw
Quoted 14 lines · Randy MacLeod
Quoted 2 lines · Joe Slater

If a terminal fails to spawn() we should continue looking. gnome-terminal, in particular can be present but not start.

Do you mean that it doesn't start on the first try but that it may / usually does start on subsequent tries?

Since the user has set the preferred terminal, this change could confuse them and therefore seems wrong. If we know of flaky terminal implementations, why not look for specific versions, issue a warning and either retry or tell the user to try again? In a few years, we can discard the code when the flaky terminal version is no longer used.

Quoted 2 lines

Is there a bug open with gnome-terminal to track this? What distro/gnome-terminal do you see this problem in?

I suspect the issue is more like gnome-terminal is present as a binary but no X desktop is running...

Cheers,

Richard

author
#3 lore raw

Yes, I think it is what Richard says. But, that's a specific case, and I think that, in general, it would be better to look for something that
does work. Like my glorious leader says, "What have you got to lose?"

The change does print out a warning, so you can check out what the problem is, if you care to.

Joe

-----Original Message-----
From: Richard Purdie <[email protected]>
Sent: Thursday, May 21, 2020 1:55 PM
To: MacLeod, Randy <[email protected]>; Slater, Joseph <[email protected]>; [email protected]
Subject: Re: [oe-core][PATCH 1/1] terminal.py: do not stop searching for auto

Quoted 14 lines · Randy MacLeod
Quoted 2 lines · Joe Slater

If a terminal fails to spawn() we should continue looking. gnome-terminal, in particular can be present but not start.

Do you mean that it doesn't start on the first try but that it may / usually does start on subsequent tries?

Since the user has set the preferred terminal, this change could confuse them and therefore seems wrong.
If we know of flaky terminal implementations, why not look for specific versions, issue a warning and either retry or tell the user to try again? In a few years, we can discard the code when the flaky terminal version is no longer used.

Quoted 2 lines

Is there a bug open with gnome-terminal to track this? What distro/gnome-terminal do you see this problem in?

I suspect the issue is more like gnome-terminal is present as a binary but no X desktop is running...

Cheers,

Richard