diff --git a/mininet/node.py b/mininet/node.py index 258ce84e24d9159083820f25f2dd9a6e3d05cb5b..7bb80ba5b9b460aecd186aa784344b55a93c98fe 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -234,7 +234,11 @@ def sendCmd( self, *args, **kwargs ): cmd = 'echo -n' self.lastCmd = cmd if printPid and not isShellBuiltin( cmd ): - cmd = 'mnexec -p ' + cmd + if len( cmd ) > 0 and cmd[ -1 ] == '&': + # print ^A{pid}\n so monitor() can set lastPid + cmd += ' printf "\\001%d\n" $! \n' + else: + cmd = 'mnexec -p ' + cmd self.write( cmd + '\n' ) self.lastPid = None self.waiting = True