Skip to content

Commit

Permalink
Add raw logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cinek810 committed Oct 23, 2023
1 parent 9013918 commit 7047335
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/modules/runners/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,12 @@ def run_playitem(self, config: dict, options: dict, inventory: str, lockpath: st
self.logger.debug("Running '%s'.", command)
try:
with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
env=command_env) as proc:
env=command_env) as proc, open(f"{self.log_path}.raw",
"a", encoding="utf-8") as raw_log:


for msg in proc.stdout:
raw_log.write(msg.decode("utf-8"))
dec_msg = msg.split(b"\n")[0].decode("utf-8")
returned.append(dec_msg)
if options["raw_output"]:
Expand Down

0 comments on commit 7047335

Please sign in to comment.