Support for control-C. Finally.

I've changed the way things work a bit:

1. netns is replaced by mnexec, a general-purpose mininet helper.

2. For interactive commands, we now use mnexec -p, which prints out
   the pid, so we can kill it when someone hits control-C!

3. We close file descriptors for subshells. This might save memory,
   but who knows.

4. We detach our subshells from the tty using mnexec -s; thus
   control-C should not terminate everything.

5. Given 4, mn -c is now necessary if you kill mininet.
This commit is contained in:
Bob Lantz
2010-03-13 18:23:07 -08:00
parent c4ae423238
commit bcacfc0510
5 changed files with 68 additions and 31 deletions
+15
View File
@@ -178,3 +178,18 @@ def makeNumeric( s ):
return float( s )
else:
return s
# pylint: disable-msg=E1101,W0612
def isShellBuiltin( cmd ):
"Return True if cmd is a bash builtin."
if isShellBuiltin.builtIns is None:
isShellBuiltin.builtIns = quietRun( 'bash -c enable' )
space = cmd.find( ' ' )
if space > 0:
cmd = cmd[ :space]
return cmd in isShellBuiltin.builtIns
isShellBuiltin.builtIns = None
# pylint: enable-msg=E1101,W0612