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

Attempt to handle interrupts in the middle of CLI commands.

parent 41badb96
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,17 @@
from mininet.log import info, output, error
def waitForNode( node ):
"Wait for a node to finish, and print its output."
while node.waiting:
try:
data = node.monitor()
info( '%s' % data )
except KeyboardInterrupt:
node.sendInt()
class CLI( Cmd ):
"Simple command-line interface to talk to nodes."
......@@ -54,6 +65,8 @@ def __init__( self, mininet ):
break
except KeyboardInterrupt:
info( 'Interrupt\n' )
for node in self.nodelist:
waitForNode( node )
def emptyline( self ):
"Don't repeat last command when you hit return."
......@@ -210,12 +223,7 @@ def default( self, line ):
rest = ' '.join( rest )
# Run cmd on node:
node.sendCmd( rest, printPid=True )
while node.waiting:
try:
data = node.monitor()
info( '%s' % data )
except KeyboardInterrupt:
node.sendInt()
waitForNode( node )
else:
self.stdout.write( '*** Unknown syntax: %s\n' % line )
......
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