From cbcc5ba269287523c3d3c3739c26059bde62ccd7 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Mon, 18 Apr 2022 11:23:48 -0400 Subject: [PATCH] cthon: Have colors script exit with the proper exit code Otherwise, the script will always return success and pipelines using cthon.zsh won't work properly Signed-off-by: Anna Schumaker --- colors/cthon.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/colors/cthon.py b/colors/cthon.py index 4481b9e..7dda6ac 100644 --- a/colors/cthon.py +++ b/colors/cthon.py @@ -5,6 +5,7 @@ import termcolor colors = { "b" : "blue", "g" : "green", "s" : "cyan", "l" : "yellow" } last = "white" newline = False +status=0 text = "" def print_text(color, attr=None): @@ -20,6 +21,7 @@ while c := sys.stdin.read(1): text = "\n" + text if newline else text newline = False print_text("red", "bold") + status=1 elif match := re.match("^./server -([bgsl]) .*?\n$", text): print_text(colors[match.group(1)], None) elif match := re.match("^Waiting for '([bgsl])' to finish...", text): @@ -33,3 +35,5 @@ while c := sys.stdin.read(1): if len(text) > 1: print_text("white", "bold") text = "" + +sys.exit(status)