From 82e0e9f38f7d7d8c9582ac668e9b38429d823b47 Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Tue, 1 Jul 2014 01:49:10 -0700
Subject: [PATCH] Avoid overhead of another process (env) in startShell()

---
 mininet/node.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mininet/node.py b/mininet/node.py
index ea0e3693..d977c61f 100644
--- a/mininet/node.py
+++ b/mininet/node.py
@@ -124,8 +124,9 @@ def startShell( self ):
             opts += 'n'
         # bash -m: enable job control, i: force interactive
         # -s: pass $* to shell, and make process easy to find in ps
-        cmd = [ 'mnexec', opts, 'env', 'PS1=' + chr( 127 ), 'bash',
-                '--norc', '-mis', 'mininet:' + self.name ]
+        # prompt is set to sentinel chr( 127 )
+        os.environ[ 'PS1' ] = chr( 127 )
+        cmd = [ 'mnexec', opts, 'bash', '--norc', '-mis', 'mininet:' + self.name ]
         # Spawn a shell subprocess in a pseudo-tty, to disable buffering
         # in the subprocess and insulate it from signals (e.g. SIGINT)
         # received by the parent
-- 
GitLab