In ed5c005071, the fix to allow the held results to be empty broke use
of hold! when no pre-existing file existed.
This is because File.zero? of a non-existing file returns false,
and thus in load_held_results the early return would not happen,
resulting in a failed attempt to parse the non-existing file:
$ ruby examples/hold.rb
Traceback (most recent call last):
3: from examples/hold.rb:22:in `<main>'
2: from ~/ruby/benchmark-ips/lib/benchmark/ips.rb:58:in `ips'
1: from ~/ruby/benchmark-ips/lib/benchmark/ips/job.rb:193:in `load_held_results'
~/ruby/benchmark-ips/lib/benchmark/ips/job.rb:193:in `read': No such file or directory @ rb_sysopen - temp_results (Errno::ENOENT)
In ed5c005071, the fix to allow the held results to be empty broke use of
hold!
when no pre-existing file existed.This is because
File.zero?
of a non-existing file returnsfalse
, and thus inload_held_results
the earlyreturn
would not happen, resulting in a failed attempt to parse the non-existing file:the full fix here is to check that both: