diff mbox series

[v2,15/49] patman: Update errors and warnings to use stderr

Message ID 20200613205717.v2.15.I60e3d9f911e1c92a4012959ca8b985c08061c742@changeid
State Accepted
Commit f9793a12c5e76c50018d516cbaa011ac86c285fa
Headers show
Series rockchip: x86: Support building ROM files automatically with binman | expand

Commit Message

Simon Glass June 14, 2020, 2:56 a.m. UTC
When warnings and errors are produced by tools they should be written to
stderr. Update the tout implementation to handle this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 tools/binman/ftest.py | 2 +-
 tools/patman/tout.py  | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Bin Meng June 29, 2020, 6:54 a.m. UTC | #1
On Sun, Jun 14, 2020 at 10:57 AM Simon Glass <sjg at chromium.org> wrote:
>
> When warnings and errors are produced by tools they should be written to
> stderr. Update the tout implementation to handle this.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> (no changes since v1)
>
>  tools/binman/ftest.py | 2 +-
>  tools/patman/tout.py  | 5 ++++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
diff mbox series

Patch

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 7c8b3eb3a0..928d3608a3 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -3232,7 +3232,7 @@  class TestFunctional(unittest.TestCase):
         with test_util.capture_sys_output() as (stdout, stderr):
             control.ReplaceEntries(updated_fname, None, outdir, [])
         self.assertIn("Skipping entry '/u-boot' from missing file",
-                      stdout.getvalue())
+                      stderr.getvalue())
 
     def testReplaceCmdMap(self):
         """Test replacing a file fron an image on the command line"""
diff --git a/tools/patman/tout.py b/tools/patman/tout.py
index c7e3272096..91a53f4073 100644
--- a/tools/patman/tout.py
+++ b/tools/patman/tout.py
@@ -83,7 +83,10 @@  def _Output(level, msg, color=None):
         ClearProgress()
         if color:
             msg = _color.Color(color, msg)
-        print(msg)
+        if level < NOTICE:
+            print(msg, file=sys.stderr)
+        else:
+            print(msg)
 
 def DoOutput(level, msg):
     """Output a message to the terminal.