Return a reference to the subprocess so output can be handled from elsewhere.

This commit is contained in:
Raquel Alegre 2017-08-11 19:00:06 +01:00
parent 58c1146387
commit 0b2eb3b1be

View file

@ -235,6 +235,11 @@ class Terraform(object):
p = subprocess.Popen(cmd_string, stdout=stdout, stderr=stderr, shell=True, p = subprocess.Popen(cmd_string, stdout=stdout, stderr=stderr, shell=True,
cwd=working_folder, env=environ_vars) cwd=working_folder, env=environ_vars)
synchronous = kwargs.pop('synchronous', True)
if not synchronous:
return p, None, None
out, err = p.communicate() out, err = p.communicate()
ret_code = p.returncode ret_code = p.returncode
log.debug('output: {o}'.format(o=out)) log.debug('output: {o}'.format(o=out))