1
0
Fork 0
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:
Yuta Saito 2022-02-17 17:31:40 +00:00 committed by Hiroshi SHIBATA
parent 8a9dfb676b
commit 3f387e60ef
Notes: git 2022-09-21 15:26:55 +09:00

View file

@ -84,7 +84,12 @@ class MSpecScript
names.each do |name|
config[:path].each do |dir|
file = File.expand_path name, 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