TimedProc: Don't assume args is a string

Both a string and a list of args are supported
This commit is contained in:
Erik Johnson 2018-11-08 10:02:38 -06:00
parent 87de250993
commit cbf05c8481
No known key found for this signature in database
GPG Key ID: 5E5583C437808F3F

View File

@ -40,8 +40,8 @@ class TimedProc(object):
if self.timeout and not isinstance(self.timeout, (int, float)):
raise salt.exceptions.TimedProcTimeoutError('Error: timeout {0} must be a number'.format(self.timeout))
if six.PY2 and kwargs.get('shell', False):
args = salt.utils.stringutils.to_bytes(args)
if kwargs.get('shell', False):
args = salt.utils.data.decode(args, to_str=True)
try:
self.process = subprocess.Popen(args, **kwargs)