Revision 4316be95 mininet/term.py

View differences:

mininet/term.py
15 15
    """Create an X11 tunnel from node:6000 to the root host
16 16
       display: display on root host (optional)
17 17
       returns: node $DISPLAY, Popen object for tunnel"""
18
    if display is None:
18
    if display is None and 'DISPLAY' in environ:
19 19
        display = environ[ 'DISPLAY' ]
20
    if display is None:
21
        error( "Error: Cannot connect to display\n" )
22
        return None, None
20 23
    host, screen = display.split( ':' )
21 24
    # Unix sockets should work
22 25
    if not host or host == 'unix':
......
49 52
        error( 'invalid terminal type: %s' % term )
50 53
        return
51 54
    display, tunnel = tunnelX11( node, display )
55
    if display is None:
56
        return []
52 57
    term = node.popen( cmds[ term ] + [ display, '-e', 'env TERM=ansi bash'] )
53 58
    return [ tunnel, term ] if tunnel else [ term ]
54 59

  
55 60
def runX11( node, cmd ):
56 61
    "Run an X11 client on a node"
57 62
    _display, tunnel = tunnelX11( node )
63
    if _display is None:
64
        return []
58 65
    popen = node.popen( cmd )
59 66
    return [ tunnel, popen ]
60 67

  

Also available in: Unified diff