Fix suppress_output_file bug where event_callback was not called #943
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sorry, I had a major flaw with #937 and I should have tested that better before it was merged.
The handle was not passed to pexpect, and that was wrong. The handle is the way that it dispatches events to the
event_callback
. Even if you do not intend to write to the stdout file, this is necessary.Design-wise, if
suppress_output_file
is given, we do want to use the stdout handle wrapper, but we do not want to use the stdout handle itself. I think this code structure articulates that about as best as possible. Alternatively, we could create a null handler and pass that toOutputEventFilter
, instead of handling theNone
case.Separately, I may have discovered a bug related to the test failures on the prior PR.
ansible-runner/ansible_runner/utils/__init__.py
Line 373 in d013044
This is assuming the
.splitlines(True)
leaves\r\n
at the end of the line. This is... not universal. Because of that, the final character in theecho
command gets truncated, because it has a\n
without the\r
. This looks completely fixable, but I wish to keep that separate.