[前][次][番号順一覧][スレッド一覧]

ruby-changes:65371

From: Marc-Andre <ko1@a...>
Date: Tue, 2 Mar 2021 09:23:55 +0900 (JST)
Subject: [ruby-changes:65371] 61f417ac7d (master): [lib/benchmark] Use $stdout instead of STDOUT [Bug #17600]

https://git.ruby-lang.org/ruby.git/commit/?id=61f417ac7d

From 61f417ac7dbcb5df096edb95a743fff45a5313c8 Mon Sep 17 00:00:00 2001
From: Marc-Andre Lafortune <github@m...>
Date: Mon, 1 Mar 2021 19:22:23 -0500
Subject: [lib/benchmark] Use $stdout instead of STDOUT [Bug #17600]

---
 lib/benchmark.rb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/benchmark.rb b/lib/benchmark.rb
index 4cfc0d8..361bca3 100644
--- a/lib/benchmark.rb
+++ b/lib/benchmark.rb
@@ -163,8 +163,8 @@ module Benchmark https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L163
   #
 
   def benchmark(caption = "", label_width = nil, format = nil, *labels) # :yield: report
-    sync = STDOUT.sync
-    STDOUT.sync = true
+    sync = $stdout.sync
+    $stdout.sync = true
     label_width ||= 0
     label_width += 1
     format ||= FORMAT
@@ -176,7 +176,7 @@ module Benchmark https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L176
     }
     report.list
   ensure
-    STDOUT.sync = sync unless sync.nil?
+    $stdout.sync = sync unless sync.nil?
   end
 
 
@@ -247,8 +247,8 @@ module Benchmark https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L247
     job = Job.new(width)
     yield(job)
     width = job.width + 1
-    sync = STDOUT.sync
-    STDOUT.sync = true
+    sync = $stdout.sync
+    $stdout.sync = true
 
     # rehearsal
     puts 'Rehearsal '.ljust(width+CAPTION.length,'-')
@@ -268,7 +268,7 @@ module Benchmark https://github.com/ruby/ruby/blob/trunk/lib/benchmark.rb#L268
       Benchmark.measure(label, &item).tap { |res| print res }
     }
   ensure
-    STDOUT.sync = sync unless sync.nil?
+    $stdout.sync = sync unless sync.nil?
   end
 
   #
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]