Skip to content

Commit 225990c

Browse files
QSchulzrpurdie
authored andcommitted
b4-wrapper-poky.py: output errors to stderr
Print error messages to stderr instead of stdout. The commands run as part of send-auto-cc-cmd and send-auto-to-cmd b4 commands will make b4 raise an Exception if they return a non-zero return code and it will only print the content of stderr before that. Because print defaults to stdout, b4 would raise the exception and not tell the user why. This commit should now provide a hint to the user about what went wrong. Reported-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
1 parent 861d6a3 commit 225990c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scripts/b4-wrapper-poky.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
ref = None
5454

5555
if not shutil.which("lsdiff"):
56-
print("lsdiff missing from host, please install patchutils")
56+
print("lsdiff missing from host, please install patchutils", file=sys.stderr)
5757
sys.exit(-1)
5858

5959
try:
@@ -80,7 +80,7 @@
8080
break
8181

8282
if not ref:
83-
print("Failed to find ref to cover letter (References:)...")
83+
print("Failed to find ref to cover letter (References:)...", file=sys.stderr)
8484
sys.exit(-2)
8585

8686
ref = ref.group(1)
@@ -143,7 +143,8 @@
143143

144144
if cmd == "prep-perpatch-check-cmd":
145145
if len(projs) > 1:
146-
print(f"Diff spans more than one project ({', '.join(sorted(projs))}), split into multiple commits...")
146+
print(f"Diff spans more than one project ({', '.join(sorted(projs))}), split into multiple commits...",
147+
file=sys.stderr)
147148
sys.exit(-3)
148149

149150
# No need to check other patches in the series as there aren't any
@@ -164,7 +165,8 @@
164165
series_check.write_text('\n'.join(uniq_series_projs))
165166

166167
if len(uniq_series_projs) > 1:
167-
print(f"Series spans more than one project ({', '.join(sorted(uniq_series_projs))}), split into multiple series...")
168+
print(f"Series spans more than one project ({', '.join(sorted(uniq_series_projs))}), split into multiple series...",
169+
file=sys.stderr)
168170
sys.exit(-4)
169171
else: # send-auto-cc-cmd / send-auto-to-cmd
170172
ml_projs = {

0 commit comments

Comments
 (0)