Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop Windows hangs when last output is on stderr #72

Merged
merged 5 commits into from
Apr 24, 2023

Conversation

andrewesweet
Copy link
Contributor

Terraform CLI runs sometimes only produce output on stderr, or writes its final output to stderr. Tests for variable validation conditions and pre/post conditions often elicit this behaviour. On Windows 10 and Python 3.9, this leads to a hang. Line 714 (in this PR) is a blocking operation that will never be satisfied given no further standard output will be observed.

This PR hacks around it when running on Windows by redirecting stderr to stdout. This truly is a hack, because later logic from line 724 onwards assumes err will contain stderr but will now always be empty. In practice, this seems to work on Windows OK.

A better solution might be to do something like https://stackoverflow.com/a/4896288. This pushes my limited python-fu.

andrewesweet and others added 5 commits April 20, 2023 12:02
Terraform CLI runs sometimes only produce output on stderr, or writes its final output to stderr. Tests for variable validation conditions and pre/post conditions often elicit this behaviour. On Windows 10 and Python 3.9, this leads to a hang. Line 714 (in this PR) is a blocking operation that will never be satisfied given no further standard output will be observed.

This PR hacks around it when running on Windows by redirecting stderr to stdout. This truly is a hack, because later logic from line 724 onwards assumes `err` will contain stderr but will now always be empty. In practice, this seems to work on Windows OK.

A better solution might be to do something like https://stackoverflow.com/a/4896288. This pushes my limited python-fu.
@ludoo ludoo merged commit 867c9e4 into GoogleCloudPlatform:master Apr 24, 2023
@ludoo
Copy link
Collaborator

ludoo commented Apr 24, 2023

Thanks! your two PRs are merged and I just cut v1.8.4

https://pypi.org/project/tftest/1.8.4/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants