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
6aff964e
Commit
6aff964e
authored
14 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Added "source" command and restored echo after noecho command.
Interactive commands should "work", sort of.
parent
272d496d
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
+29
-2
29 additions, 2 deletions
mininet/cli.py
with
29 additions
and
2 deletions
mininet/cli.py
+
29
−
2
View file @
6aff964e
...
...
@@ -50,6 +50,7 @@ def __init__( self, mininet, stdin=sys.stdin ):
self
.
stdin
=
stdin
self
.
inPoller
=
poll
()
self
.
inPoller
.
register
(
stdin
)
self
.
inputFile
=
None
Cmd
.
__init__
(
self
)
info
(
'
*** Starting CLI:
\n
'
)
while
True
:
...
...
@@ -217,7 +218,26 @@ def do_noecho( self, line ):
if
self
.
isatty
():
quietRun
(
'
stty -echo
'
)
self
.
default
(
line
)
# default() fixes tty
if
self
.
isatty
():
quietRun
(
'
stty echo
'
)
def
do_source
(
self
,
line
):
"
Read commands from an input file.
"
args
=
line
.
split
()
if
len
(
args
)
!=
1
:
error
(
'
usage: source <file>
\n
'
)
return
try
:
self
.
inputFile
=
open
(
args
[
0
]
)
while
True
:
line
=
self
.
inputFile
.
readline
()
if
len
(
line
)
>
0
:
self
.
onecmd
(
line
)
else
:
break
except
IOError
:
pass
self
.
inputFile
=
None
def
default
(
self
,
line
):
"""
Called on an input line when the command prefix is not recognized.
...
...
@@ -226,7 +246,7 @@ def default( self, line ):
corresponding IP addrs.
"""
first
,
args
,
line
=
self
.
parseline
(
line
)
if
len
(
args
)
>
0
and
args
[
-
1
]
==
'
\n
'
:
if
args
and
len
(
args
)
>
0
and
args
[
-
1
]
==
'
\n
'
:
args
=
args
[
:
-
1
]
rest
=
args
.
split
(
'
'
)
...
...
@@ -243,6 +263,7 @@ def default( self, line ):
self
.
waitForNode
(
node
)
else
:
error
(
'
*** Unknown command: %s
\n
'
%
first
)
# pylint: enable-msg=W0613,R0201
...
...
@@ -261,6 +282,12 @@ def waitForNode( self, node ):
while
True
:
try
:
bothPoller
.
poll
()
if
self
.
inputFile
:
key
=
self
.
inputFile
.
read
(
1
)
if
key
is
not
''
:
node
.
write
(
key
)
else
:
self
.
inputFile
=
None
if
isReadable
(
self
.
inPoller
):
key
=
self
.
stdin
.
read
(
1
)
node
.
write
(
key
)
...
...
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