python-terraform
python-terraform copied to clipboard
Use context manager for Popen
On Python 3.2+ Popen should be used as context manager, otherwise very obscure errors happen on Windows with multiple invocations of Popen.
From https://docs.python.org/3/library/subprocess.html:
with Popen(["ifconfig"], stdout=PIPE) as proc:
log.write(proc.stdout.read())
@kshpytsya thank you for reporting this. it's awesome to identify this issue. I'll look into it this weekend, or you're always welcome to file a PR for this 👍