From e3d150ec904179fd2d529763491692ee3b192c44 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Sat, 24 Sep 2022 02:21:57 -0500 Subject: [PATCH] Flush stdout before subprocess.run This commit adds sys.stdout.flush() before subprocess.run() in ansible_collection.py. Without this, the print statements are shown after the command output when building in mock. --- ansible_collection.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ansible_collection.py b/ansible_collection.py index 17c6777..70093be 100755 --- a/ansible_collection.py +++ b/ansible_collection.py @@ -70,6 +70,9 @@ class AnsibleCollection: ) print(f"Running: {args}") print() + # Without this, the print statements are shown after the command + # output when building in mock. + sys.stdout.flush() subprocess.run(args, check=True, cwd=self.collection_srcdir) print() @@ -90,6 +93,9 @@ class AnsibleCollection: args = ("ansible-test", "units", *extra_args) print(f"Running: {args}") print() + # Without this, the print statements are shown after the command + # output when building in mock. + sys.stdout.flush() subprocess.run(args, cwd=temppath, check=True)