Closed jimpo closed 7 years ago
Hi @jimpo and thanks a lot for this.
I just changed a bit the way File.new
works so that you should be able to avoid the begin … rescue
block. Would you be so kind to rebase and update this PR, that'd be awesome ☺️
Thanks! :wink:
@simonc When I remove the rescue spec/memfs/file_spec.rb:2428
fails with an ENOENT error. Should I add the rescue back?
@jimpo no, at that point the entry should be there. If it's not it's an issue. The begin .. rescue
treats the symptome, not the disease. I'd like to find why it does this. I'll investigate!
@jimpo OK, as I thought it was a bad spec since File.new
should raise if the passed filename is a symlink with an absent target.
I'm gonna fix the spec and then your change should pass with no trouble.
@jimpo the issue is fixed. I would recommand to add a condition to the position reset though.
Since File.new
accepts directories and they might not accept pos=
I'd use the following code:
if entry.respond_to?(:pos=)
entry.pos = 0
end
Thanks!
Thanks for following up on this!
My pleasure ☺️
Fixes https://github.com/simonc/memfs/issues/22.