Skip to content

Conversation

@gwintrob
Copy link

Summary

  • Fixes the RubyGem installation producing no output and silently exiting

Problem

When bin/try uses require_relative to load try.rb, the __FILE__ variable in try.rb is set to try.rb's path, while $0 remains bin/try's path. This causes the if __FILE__ == $0 guard to fail, skipping all main execution logic.

Solution

Set $0 to try.rb's path before loading it with load, ensuring the guard condition passes.

Test plan

  • Run bin/try and verify help text is displayed
  • Run bin/try --help and verify help text is displayed
  • Run bin/try init and verify shell function is output

Fixes #92

🤖 Generated with Claude Code

When bin/try uses require_relative to load try.rb, the __FILE__ variable
in try.rb is set to try.rb path, while $0 remains bin/try path.
This causes the if __FILE__ == $0 guard to fail, skipping all main
execution logic.

Fix by setting $0 to try.rb path before loading it, ensuring the
guard condition passes.

Fixes tobi#92

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gwintrob
Copy link
Author

Whoops, this is a dupe of #88

@gwintrob gwintrob closed this Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 RubyGem version silently does nothing due to __FILE__ == $0 check

1 participant