summaryrefslogtreecommitdiff
path: root/lib/benchmark.rb
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2021-03-01 19:22:23 -0500
committerMarc-Andre Lafortune <github@marc-andre.ca>2021-03-01 19:23:21 -0500
commit61f417ac7dbcb5df096edb95a743fff45a5313c8 (patch)
tree472512d00f8d6ccf247b791c805d3dfecf0530e1 /lib/benchmark.rb
parent80e2c45f5560a2e44fb3949c5c3f5a11508f6043 (diff)
[lib/benchmark] Use $stdout instead of STDOUT [Bug #17600]
Diffstat (limited to 'lib/benchmark.rb')
-rw-r--r--lib/benchmark.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/benchmark.rb b/lib/benchmark.rb
index 4cfc0d8a5b..361bca3cad 100644
--- a/lib/benchmark.rb
+++ b/lib/benchmark.rb
@@ -163,8 +163,8 @@ module Benchmark
#
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
}
report.list
ensure
- STDOUT.sync = sync unless sync.nil?
+ $stdout.sync = sync unless sync.nil?
end
@@ -247,8 +247,8 @@ module Benchmark
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
Benchmark.measure(label, &item).tap { |res| print res }
}
ensure
- STDOUT.sync = sync unless sync.nil?
+ $stdout.sync = sync unless sync.nil?
end
#