From 0843ae874643a39a42a11a91d1fbb72c93d43d9b Mon Sep 17 00:00:00 2001 From: Jan Niklas Hasse Date: Thu, 10 Jun 2021 21:25:04 +0200 Subject: Put Info output back on stdout instead of stderr See comment in #1899. Also adds two tests to output_test.py which check this behaviour by relying on Python's suprocess.check_output not piping stderr. --- misc/output_test.py | 5 +++++ src/util.cc | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) mode change 100755 => 100644 misc/output_test.py diff --git a/misc/output_test.py b/misc/output_test.py old mode 100755 new mode 100644 index 6858e21..45698f1 --- a/misc/output_test.py +++ b/misc/output_test.py @@ -119,6 +119,7 @@ red def test_status(self): self.assertEqual(run(''), 'ninja: no work to do.\n') + self.assertEqual(run('', pipe=True), 'ninja: no work to do.\n') def test_ninja_status_default(self): 'Do we show the default status by default?' @@ -129,5 +130,9 @@ red output = run(Output.BUILD_SIMPLE_ECHO, flags='--quiet') self.assertEqual(output, 'do thing\n') + def test_entering_directory_on_stdout(self): + output = run(Output.BUILD_SIMPLE_ECHO, flags='-C$PWD', pipe=True) + self.assertEqual(output.splitlines()[0][:25], "ninja: Entering directory") + if __name__ == '__main__': unittest.main() diff --git a/src/util.cc b/src/util.cc index b40a636..f34656c 100644 --- a/src/util.cc +++ b/src/util.cc @@ -105,9 +105,9 @@ void Error(const char* msg, ...) { } void Info(const char* msg, va_list ap) { - fprintf(stderr, "ninja: "); - vfprintf(stderr, msg, ap); - fprintf(stderr, "\n"); + fprintf(stdout, "ninja: "); + vfprintf(stdout, msg, ap); + fprintf(stdout, "\n"); } void Info(const char* msg, ...) { -- cgit v0.12