Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
util: subprocess: Fix stdout/err yield only if in desired set of even…
Browse files Browse the repository at this point in the history
…ts to listen to

Signed-off-by: John Andersen <[email protected]>
  • Loading branch information
John Andersen authored and pdxjohnny committed Jul 7, 2022
1 parent a70420c commit 5e7c10d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions dffml/util/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,16 @@ async def run_command_events(
repr(cmd) + ": " + b"".join(output["combinded"]).decode()
)
else:
yield Subprocess.STDERR, b"".join(
output[Subprocess.STDERR_READLINE]
)
yield Subprocess.STDOUT, b"".join(
output[Subprocess.STDOUT_READLINE]
)
# If caller wants event
if Subprocess.STDERR in events:
yield Subprocess.STDERR, b"".join(
output[Subprocess.STDERR_READLINE]
)
if Subprocess.STDOUT in events:
yield Subprocess.STDOUT, b"".join(
output[Subprocess.STDOUT_READLINE]
)
return
# If caller wants event
if events and event in events:
yield event, result
Expand Down

0 comments on commit 5e7c10d

Please sign in to comment.