-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Description
Description
When installing try-cli via RubyGems (gem install try-cli), running the try command does nothing and exits with code 0.
Possible Root Cause
The issue is in try.rb at line 789:
if __FILE__ == $0
When installed via RubyGems, a wrapper script (binstub) is automatically generated. The execution flow becomes:
- User runs the RubyGems wrapper at /path/to/bin/try
- $0 is set to the wrapper path
- Wrapper calls Gem.activate_and_load_bin_path, which loads bin/try
- bin/try executes require_relative '../try'
- In try.rb:
__FILE__= .../gems/try-cli-1.7.1/try.rb, but $0 = /path/to/bin/try - Since
__FILE__!= $0, the main execution block is skipped
Steps to Reproduce
gem install try-cli
try --help # No output, exits 0
Expected Behavior
The help message should be displayed.
Actual Behaviour in my environment
My Environment
- WSL
- Fish shell
- Ruby 4.0.1 (installed via mise)
- try-cli 1.7.1
Metadata
Metadata
Assignees
Labels
No labels