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 38b8146
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions 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 Expand Up @@ -169,7 +172,7 @@ def run_playitem(self, config: dict, options: dict, inventory: str, lockpath: st
self.sequence_id)
db_writer.finalize_db_write(sequence_records, True)
sys.exit(72)
return sequence_records
return sequence_records

@staticmethod
def get_tags_for_task(config: dict, options: dict):
Expand Down

0 comments on commit 38b8146

Please sign in to comment.