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
de901ef0
Commit
de901ef0
authored
14 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Modified to allow execed nodes to work, if we ever reinstate them.
parent
b1affce8
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/term.py
+24
-13
24 additions, 13 deletions
mininet/term.py
with
24 additions
and
13 deletions
mininet/term.py
+
24
−
13
View file @
de901ef0
...
...
@@ -12,35 +12,46 @@
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
makeTerm
(
node
,
title
=
''
,
term
=
'
xterm
'
):
"""
Run screen on a node, and hook up a
n x
term.
"""
Run screen on a node, and hook up a
term
inal
.
node: Node object
title: base title
term:
'
xterm
'
or
'
gterm
'
returns: process created
"""
title
+=
'
:
'
+
node
.
name
if
not
node
.
inNamespace
:
title
+=
'
(root)
'
cmd
=
''
if
term
==
'
xterm
'
:
cmd
=
[
'
xterm
'
,
'
-title
'
,
title
,
'
-e
'
]
elif
term
==
'
gnome
'
:
cmd
=
[
'
gnome-terminal
'
,
'
--title
'
,
title
,
'
-e
'
]
else
:
cmds
=
{
'
xterm
'
:
[
'
xterm
'
,
'
-title
'
,
title
,
'
-e
'
],
'
gterm
'
:
[
'
gnome-terminal
'
,
'
--title
'
,
title
,
'
-e
'
]
}
if
term
not
in
cmds
:
error
(
'
invalid terminal type: %s
'
%
term
)
return
if
not
node
.
execed
:
node
.
cmd
(
'
screen -dmS
'
+
node
.
name
)
#cmd += [ 'screen', '-D', '-RR', '-S', node.name ]
args
=
[
'
screen
'
,
'
-D
'
,
'
-RR
'
,
'
-S
'
,
'
mininet.
'
+
node
.
name
]
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 .
cmd
+=
[
'
screen -D -RR -S
'
+
node
.
name
]
else
:
cmd
+=
[
'
sh
'
,
'
-c
'
,
'
exec tail -f /tmp/
'
+
node
.
name
+
'
*.log
'
]
return
Popen
(
cmd
)
args
=
joinCmd
(
args
)
return
Popen
(
cmds
[
term
]
+
args
)
def
cleanUpScreens
():
"
Remove moldy old screen sessions.
"
r
=
r
'
(\d+.[hsc]\d+)
'
r
=
r
'
(\d+
which
.[hsc]\d+)
'
output
=
quietRun
(
'
screen -ls
'
).
split
(
'
\n
'
)
for
line
in
output
:
m
=
re
.
search
(
r
,
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