Skip to content

Restore $! when catching exception.#615

Merged
enebo merged 1 commit intojruby:masterfrom
tychobrailleur:exist_fix
Apr 24, 2013
Merged

Restore $! when catching exception.#615
enebo merged 1 commit intojruby:masterfrom
tychobrailleur:exist_fix

Conversation

@tychobrailleur
Copy link
Contributor

Hack-ish workaround for JRUBY-7134 that restores $! when an exception is thrown when checking whether the dir exists.

Added also pull request for rubyspec.

@BanzaiMan
Copy link
Member

This works, but I am a bit worried about committing this. I have not looked at MRI source, but ideally we should add smarts to FileStat to avoid setting $! in the first place if the operand is a directory.

@tychobrailleur
Copy link
Contributor Author

Yup. As I said, hack-ish. The alternative is to modify jnr-posix directly, or amend JRubyPOSIXHandler to interact with it, but I was a bit reluctant to do that.

enebo added a commit that referenced this pull request Apr 24, 2013
Restore $! when catching exception.  In most cases jnr-posix on an error will throw and not get caught like this.   This is a special case and without significant changes jnr-posix this looks like the best fix to me.
@enebo enebo merged commit de7171d into jruby:master Apr 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants