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.
This commit is contained in:
Damien Saucez
2019-04-23 08:42:07 +02:00
committed by GitHub
parent c5f23b9f82
commit 7c0d1506e7
+1 -1
View File
@@ -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]