summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-06-30 17:15:37 +0200
committerChristian Breunig <christian@breunig.cc>2026-06-30 15:19:36 +0000
commitfe6b32d3e31a94d5e2156bcf2273e42a172b90a1 (patch)
tree370bc703c753e964fc8e6aba2758444361b591a1 /python
parentcc0d4c4316c8aa297261da659bbb024e0742306c (diff)
downloadvyos-1x-fe6b32d3e31a94d5e2156bcf2273e42a172b90a1.tar.gz
vyos-1x-fe6b32d3e31a94d5e2156bcf2273e42a172b90a1.zip
vyos.utils: T8981: catch_broken_pipe() decorator must return func(*args, **kwargs)
"show system commit diff <rev>" produces no output (exit 0) for any revision, regardless of how much the revisions differ. The revision store and diff engine are intact - "show system commit file <rev>" works, and so does ConfigMgmt().compare(rev1=0, rev2=1) which returns the correct diff when called directly. Commit a29d73d00 ("op-mode: T8362: "compare" command lacks catch_broken_pipe decorator") added @catch_broken_pipe to ConfigMgmt.show_commit_diff to suppress BrokenPipeError tracebacks when piping output, but the decorator calls the wrapped function without returning its value. Thus the op-mode framework will receive None and prints nothing.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/utils/io.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/python/vyos/utils/io.py b/python/vyos/utils/io.py
index 3efb55ddc..77e30cbb0 100644
--- a/python/vyos/utils/io.py
+++ b/python/vyos/utils/io.py
@@ -117,7 +117,7 @@ def catch_broken_pipe(func):
import sys
def wrapped(*args, **kwargs):
try:
- func(*args, **kwargs)
+ return func(*args, **kwargs)
except (BrokenPipeError, KeyboardInterrupt):
# Flush output to /dev/null and bail out.
os.dup2(os.open(os.devnull, os.O_WRONLY), sys.stdout.fileno()) # pylint: disable = no-member