[oe-commits] Peter Seebach : handle two-word commands with tmux

git at git.openembedded.org git at git.openembedded.org
Wed Jun 12 12:19:45 UTC 2013


Module: openembedded-core.git
Branch: master-next
Commit: f8ed7446755eeb88191e16749350efa1e7e6197c
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=f8ed7446755eeb88191e16749350efa1e7e6197c

Author: Peter Seebach <peter.seebach at windriver.com>
Date:   Tue Jun 11 09:28:03 2013 -0500

handle two-word commands with tmux

Trying to make a devshell using tmux can fail because "tmux new"
expects a single command, not a series of arguments. It does, however,
split strings in a suitable way. So you can quote the command.

The failure mode is particularly arcane, in that you end up
with a message like:

	ERROR: Unable to spawn terminal auto: \
	Execution of 'pseudo /bin/bash' failed with exit code 1:
	usage: new-session [-d] [-n window-name] [-s session-name] \
	[-t target-session] [command]

which is confusing because there's no "new-session" anywhere in
sight (that's actually "tmux new"), and because what failed to execute
wasn't either pseudo or bash.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oe/terminal.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 28470e3..25f8004 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -122,7 +122,7 @@ class TmuxRunning(Terminal):
 
 class Tmux(Terminal):
     """Start a new tmux session and window"""
-    command = 'tmux new -d -s devshell -n devshell {command}'
+    command = 'tmux new -d -s devshell -n devshell "{command}"'
     priority = 0.75
 
     def __init__(self, sh_cmd, title=None, env=None, d=None):
@@ -133,7 +133,7 @@ class Tmux(Terminal):
         # devshells, if it's already there, add a new window to it.
         window_name = 'devshell-%i' % os.getpid()
 
-        self.command = 'tmux new -d -s {0} -n {0} {{command}}'.format(window_name)
+        self.command = 'tmux new -d -s {0} -n {0} "{{command}}"'.format(window_name)
         Terminal.__init__(self, sh_cmd, title, env, d)
 
         attach_cmd = 'tmux att -t {0}'.format(window_name)



More information about the Openembedded-commits mailing list