From 628d3fc277c0d5b3e86a6b87c18478b281543d25 Mon Sep 17 00:00:00 2001 From: Rob Meades Date: Mon, 23 Oct 2023 00:16:15 +0100 Subject: [PATCH] Github action fix only: fail on AStyle failure. (#1024) The Github action wasn't failing if AStyle returned an error. It does now. --- .github/workflows/style.yml | 3 +-- astyle.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index b8791b21..37eecc71 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -18,5 +18,4 @@ jobs: sudo apt install doxygen astyle python3 - name: check run: | - python3 astyle.py - UBX_WORKDIR="$(pwd)" doxygen + python3 astyle.py && UBX_WORKDIR="$(pwd)" doxygen \ No newline at end of file diff --git a/astyle.py b/astyle.py index b36ca520..eb5194f8 100644 --- a/astyle.py +++ b/astyle.py @@ -13,11 +13,11 @@ stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) as astyle: fail = False - output = astyle.communicate() - for line in output: + output, _ = astyle.communicate() + for line in output.splitlines(): if line.startswith("Formatted"): fail = True - print (line, end="") + print (line) if astyle.returncode != 0: fail = True sys.exit(1 if fail else 0)