8000 Use $stdout instead of STDOUT [Bug #17600] · ruby/benchmark@926c883 · GitHub
[go: up one dir, main page]

Skip to content

Commit 926c883

Browse files
committed
Use $stdout instead of STDOUT [Bug #17600]
1 parent 6b94aaf commit 926c883

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/benchmark.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ module Benchmark
163163
#
164164

165165
def benchmark(caption = "", label_width = nil, format = nil, *labels) # :yield: report
166-
sync = STDOUT.sync
167-
STDOUT.sync = true
166+
sync = $stdout.sync
167+
$stdout.sync = true
168168
label_width ||= 0
169169
label_width += 1
170170
format ||= FORMAT
@@ -176,7 +176,7 @@ def benchmark(caption = "", label_width = nil, format = nil, *labels) # :yield:
176176
}
177177
report.list
178178
ensure
179-
STDOUT.sync = sync unless sync.nil?
179+
$stdout.sync = sync unless sync.nil?
180180
end
181181

182182

@@ -247,8 +247,8 @@ def bmbm(width = 0) # :yield: job
247247
job = Job.new(width)
248248
yield(job)
249249
width = job.width + 1
250-
sync = STDOUT.sync
251-
STDOUT.sync = true
250+
sync = $stdout.sync
251+
$stdout.sync = true
252252

253253
# rehearsal
254254
puts 'Rehearsal '.ljust(width+CAPTION.length,'-')
@@ -268,7 +268,7 @@ def bmbm(width = 0) # :yield: job
268268
Benchmark.measure(label, &item).tap { |res| print res }
269269
}
270270
ensure
271-
STDOUT.sync = sync unless sync.nil?
271+
$stdout.sync = sync unless sync.nil?
272272
end
273273

274274
#

0 commit comments

Comments
 (0)
0