mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Rescue File.expand_path in MSpecScript#try_load if HOME is unavailable
mspec tries to load ~/.mspecrc, but some platforms (e.g. WASI) doesn't have HOME concept, so `~` cannot be expanded and `File.expand_path` can fail.
This commit is contained in:
parent
8a9dfb676b
commit
3f387e60ef
Notes:
git
2022-09-21 15:26:55 +09:00
1 changed files with 6 additions and 1 deletions
|
@ -84,7 +84,12 @@ class MSpecScript
|
|||
|
||||
names.each do |name|
|
||||
config[:path].each do |dir|
|
||||
begin
|
||||
file = File.expand_path name, dir
|
||||
rescue ArgumentError
|
||||
# File.expand_path can issue error e.g. if HOME is not available
|
||||
next
|
||||
end
|
||||
if @loaded.include?(file)
|
||||
return true
|
||||
elsif File.exist? file
|
||||
|
|
Loading…
Reference in a new issue