diff options
author | Yuta Saito <[email protected]> | 2022-02-17 17:31:40 +0000 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2022-09-21 15:26:34 +0900 |
commit | 3f387e60ef87d61d5503132f02b96bba8caa32bd (patch) | |
tree | 1346edd180639fd4958b0361c0aee58bb6c283f1 /spec/mspec/lib | |
parent | 8a9dfb676b0df74644ddd1db6cfefdd2c9283e8a (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5566
Diffstat (limited to 'spec/mspec/lib')
-rw-r--r-- | spec/mspec/lib/mspec/utils/script.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/mspec/lib/mspec/utils/script.rb b/spec/mspec/lib/mspec/utils/script.rb index b9f8b17fdc..dd1603c20a 100644 --- a/spec/mspec/lib/mspec/utils/script.rb +++ b/spec/mspec/lib/mspec/utils/script.rb @@ -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 |