avoid JRuby bug when reading directory as file

one would expect an EISDIR error, but instead JRuby
seems to get stuck using 100% CPU and getting nowhere.
Cmdtest just needs to be able to issue an error message.
This commit is contained in:
Johan Holmberg 2016-11-26 23:15:19 +01:00
parent 58ca0a1e8b
commit e7001794fa

View File

@ -489,10 +489,13 @@ module Cmdtest
#------------------------------
def _read_file(what, file)
if File.directory?(_cwd_path(file)) && Util.windows?
path = _cwd_path(file)
if Util.windows? && File.directory?(path)
:is_directory
elsif (RUBY_PLATFORM =~ /java/) && File.directory?(path)
:is_directory
else
Util.read_file(what, _cwd_path(file))
Util.read_file(what, path)
end
rescue Errno::ENOENT
:no_such_file