Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix suppress_output_file bug where event_callback was not called (#943)
Fix suppress_output_file bug where event_callback was not called 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 to OutputEventFilter, instead of handling the None 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 event_data['stdout'] = stdout_chunk[:-2] if len(stdout_chunk) > 2 else "" 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 the echo command gets truncated, because it has a \n without the \r. This looks completely fixable, but I wish to keep that separate. Reviewed-by: David Shrewsbury <None> Reviewed-by: None <None> Reviewed-by: Alexander Sowitzki <dev@eqrx.net>
- Loading branch information
1 parent
d013044
commit 2d073fe
Showing
3 changed files
with
26 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters