recover from, and warn when, .rsconscache loads something other than a Hash
This commit is contained in:
parent
9b954d9d98
commit
45a0d56c54
@ -61,6 +61,10 @@ module Rscons
|
|||||||
# file.
|
# file.
|
||||||
def initialize
|
def initialize
|
||||||
@cache = YAML.load(File.read(CACHE_FILE)) rescue {}
|
@cache = YAML.load(File.read(CACHE_FILE)) rescue {}
|
||||||
|
unless @cache.is_a?(Hash)
|
||||||
|
$stderr.puts "Warning: #{CACHE_FILE} was corrupt. Contents:\n#{@cache.inspect}"
|
||||||
|
@cache = {}
|
||||||
|
end
|
||||||
@cache[:targets] ||= {}
|
@cache[:targets] ||= {}
|
||||||
@cache[:directories] ||= {}
|
@cache[:directories] ||= {}
|
||||||
@cache[:version] ||= VERSION
|
@cache[:version] ||= VERSION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user