Skip to content
Snippets Groups Projects
Commit 9ab2cba8 authored by Bob Lantz's avatar Bob Lantz
Browse files

Fixed gterm support; quote and join -e argument.

parent 99c035d9
No related branches found
No related tags found
No related merge requests found
......@@ -12,16 +12,10 @@
from mininet.log import error
from mininet.util import quietRun
def joinCmd( args ):
"Join args into a string, single-quoting items with spaces."
result = ''
for arg in args:
if ' ' in item:
result += " '%s'" % arg
else:
result += " %s" % arg
return result
def quoteArg( arg ):
"Quote an argument if it contains spaces."
return repr( arg ) if ' ' in arg else arg
def makeTerm( node, title = 'Node', term = 'xterm' ):
"""Run screen on a node, and hook up a terminal.
node: Node object
......@@ -44,9 +38,9 @@ def makeTerm( node, title = 'Node', term = 'xterm' ):
else:
args = [ 'sh', '-c', 'exec tail -f /tmp/' + node.name + '*.log' ]
if term == 'gterm':
# Compress these for gnome-terminal, which expects one token to follow
# the -e option .
args = joinCmd( args )
# Compress these for gnome-terminal, which expects one token
# to follow the -e option
args = [ ' '.join( [ quoteArg( arg ) for arg in args ] ) ]
return Popen( cmds[ term ] + args )
def cleanUpScreens():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment