Allow sendCmd( [ cmd, arg1, ... ] )

This commit is contained in:
Bob Lantz
2012-03-20 00:10:11 -07:00
parent bf9c6ab7b4
commit 318ae55e35
+6 -1
View File
@@ -194,8 +194,13 @@ class Node( object ):
printPid: print command's PID?""" printPid: print command's PID?"""
assert not self.waiting assert not self.waiting
printPid = kwargs.get( 'printPid', True ) printPid = kwargs.get( 'printPid', True )
if len( args ) > 0: # Allow sendCmd( [ list ] )
if len( args ) == 1 and type( args[ 0 ] ) is list:
cmd = args[ 0 ]
# Allow sendCmd( cmd, arg1, arg2... )
elif len( args ) > 0:
cmd = args cmd = args
# Convert to string
if not isinstance( cmd, str ): if not isinstance( cmd, str ):
cmd = ' '.join( [ str( c ) for c in cmd ] ) cmd = ' '.join( [ str( c ) for c in cmd ] )
if not re.search( r'\w', cmd ): if not re.search( r'\w', cmd ):