Skip to content

Commit

Permalink
Only decode when there's output
Browse files Browse the repository at this point in the history
  • Loading branch information
guyer committed Sep 5, 2023
1 parent 5ef3ae3 commit 316760a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ntd2d/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ def main():

if __name__ == "__main__":
try:
main()
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as e:
gha_utils.echo(f"what is happening?", use_subprocess=True)
gha_utils.echo(f"stdout: {e.stdout.decode('utf-8')[:1000]}", use_subprocess=True)
gha_utils.echo(f"stderr: {e.stderr.decode('utf-8')[:1000]}", use_subprocess=True)
sys.exit(1)
try:
main()
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as e:
if e.stdout is not None:
gha_utils.echo(f"stdout: {e.stdout.decode('utf-8')}", use_subprocess=True)
if e.stderr is not None:
gha_utils.echo(f"stderr: {e.stderr.decode('utf-8')}", use_subprocess=True)
raise
except Exception as e:
gha_utils.error("".join(traceback.format_exception(e)), use_subprocess=True)
sys.exit(1)

0 comments on commit 316760a

Please sign in to comment.