[lib/benchmark] Use $stdout instead of STDOUT [Bug #17600]
This commit is contained in:
parent
80e2c45f55
commit
61f417ac7d
@ -163,8 +163,8 @@ module Benchmark
|
|||||||
#
|
#
|
||||||
|
|
||||||
def benchmark(caption = "", label_width = nil, format = nil, *labels) # :yield: report
|
def benchmark(caption = "", label_width = nil, format = nil, *labels) # :yield: report
|
||||||
sync = STDOUT.sync
|
sync = $stdout.sync
|
||||||
STDOUT.sync = true
|
$stdout.sync = true
|
||||||
label_width ||= 0
|
label_width ||= 0
|
||||||
label_width += 1
|
label_width += 1
|
||||||
format ||= FORMAT
|
format ||= FORMAT
|
||||||
@ -176,7 +176,7 @@ module Benchmark
|
|||||||
}
|
}
|
||||||
report.list
|
report.list
|
||||||
ensure
|
ensure
|
||||||
STDOUT.sync = sync unless sync.nil?
|
$stdout.sync = sync unless sync.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -247,8 +247,8 @@ module Benchmark
|
|||||||
job = Job.new(width)
|
job = Job.new(width)
|
||||||
yield(job)
|
yield(job)
|
||||||
width = job.width + 1
|
width = job.width + 1
|
||||||
sync = STDOUT.sync
|
sync = $stdout.sync
|
||||||
STDOUT.sync = true
|
$stdout.sync = true
|
||||||
|
|
||||||
# rehearsal
|
# rehearsal
|
||||||
puts 'Rehearsal '.ljust(width+CAPTION.length,'-')
|
puts 'Rehearsal '.ljust(width+CAPTION.length,'-')
|
||||||
@ -268,7 +268,7 @@ module Benchmark
|
|||||||
Benchmark.measure(label, &item).tap { |res| print res }
|
Benchmark.measure(label, &item).tap { |res| print res }
|
||||||
}
|
}
|
||||||
ensure
|
ensure
|
||||||
STDOUT.sync = sync unless sync.nil?
|
$stdout.sync = sync unless sync.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user