Fix pexec('echo foo', shell=True)
This commit is contained in:
@@ -297,6 +297,8 @@ class Node( object ):
|
|||||||
elif type( args[ 0 ] ) is str:
|
elif type( args[ 0 ] ) is str:
|
||||||
# popen("cmd arg1 arg2...")
|
# popen("cmd arg1 arg2...")
|
||||||
cmd = args[ 0 ].split()
|
cmd = args[ 0 ].split()
|
||||||
|
else:
|
||||||
|
raise Exception( 'popen() requires a string or list' )
|
||||||
elif len( args ) > 0:
|
elif len( args ) > 0:
|
||||||
# popen( cmd, arg1, arg2... )
|
# popen( cmd, arg1, arg2... )
|
||||||
cmd = args
|
cmd = args
|
||||||
@@ -304,6 +306,9 @@ class Node( object ):
|
|||||||
mncmd = defaults[ 'mncmd' ]
|
mncmd = defaults[ 'mncmd' ]
|
||||||
del defaults[ 'mncmd' ]
|
del defaults[ 'mncmd' ]
|
||||||
cmd = mncmd + cmd
|
cmd = mncmd + cmd
|
||||||
|
# Shell requires a string, not a list!
|
||||||
|
if defaults.get( 'shell', False ):
|
||||||
|
cmd = ' '.join( cmd )
|
||||||
return Popen( cmd, **defaults )
|
return Popen( cmd, **defaults )
|
||||||
|
|
||||||
def pexec( self, *args, **kwargs ):
|
def pexec( self, *args, **kwargs ):
|
||||||
|
|||||||
Reference in New Issue
Block a user