Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mininet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olaf Bergmann
mininet
Commits
c2cc1aac
Commit
c2cc1aac
authored
14 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Attempt to handle interrupts in the middle of CLI commands.
parent
41badb96
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mininet/cli.py
+14
-6
14 additions, 6 deletions
mininet/cli.py
with
14 additions
and
6 deletions
mininet/cli.py
+
14
−
6
View file @
c2cc1aac
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment