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.
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 @@
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 @@
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 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, ...) {