From f393f72dbf3b61d9deffa618b22d672156c78da6 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Mon, 9 Mar 2020 09:42:40 -0700 Subject: [PATCH] Make verbose output go to stdout instead of stderr Verbose output is not error output, and should be sent to stdout and not stderr. Fixes Ruby bug 4436 --- lib/fileutils.rb | 2 +- test/fileutils/test_fileutils.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index a7ad65a..25ab16d 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -1614,7 +1614,7 @@ def fu_same?(a, b) #:nodoc: def fu_output_message(msg) #:nodoc: output = @fileutils_output if defined?(@fileutils_output) - output ||= $stderr + output ||= $stdout if defined?(@fileutils_label) msg = @fileutils_label + msg end diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index ca435ed..ea3c949 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -1709,16 +1709,16 @@ def test_chdir_verbose_frozen o.extend(FileUtils) o.singleton_class.send(:public, :chdir) o.freeze - orig_stderr = $stderr - $stderr = StringIO.new + orig_stdout = $stdout + $stdout = StringIO.new o.chdir('.', verbose: true){} - $stderr.rewind - assert_equal(<<-END, $stderr.read) + $stdout.rewind + assert_equal(<<-END, $stdout.read) cd . cd - END ensure - $stderr = orig_stderr if orig_stderr + $stdout = orig_stdout if orig_stdout end def test_getwd