From 7c0d1506e7b75c213080e99ff1a520b914018c1d Mon Sep 17 00:00:00 2001 From: Damien Saucez Date: Tue, 23 Apr 2019 08:42:07 +0200 Subject: [PATCH] change isShellBuiltin change isShellBuiltin to have each builtin as a different token in a set and lookup cmd to be an element of the set instead of a sequence of characters in a string (tested only on Python 3.6.7). Corrected according to @lantz comments. --- mininet/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mininet/util.py b/mininet/util.py index 3a97c4c..f551737 100644 --- a/mininet/util.py +++ b/mininet/util.py @@ -181,7 +181,7 @@ def which(cmd, **kwargs ): def isShellBuiltin( cmd ): "Return True if cmd is a bash builtin." if isShellBuiltin.builtIns is None: - isShellBuiltin.builtIns = quietRun( 'bash -c enable' ) + isShellBuiltin.builtIns = set(quietRun( 'bash -c enable' ).split()) space = cmd.find( ' ' ) if space > 0: cmd = cmd[ :space]