Description
When installing via gem install try-cli, the try command produces no output and silently exits. This affects version 1.7.1 (and likely earlier versions).
Root Cause
In bin/try:
require_relative '../try'
In try.rb, all main execution logic is guarded by:
When bin/try uses require_relative, __FILE__ in try.rb is the path to try.rb, but $0 remains the path to bin/try. They never match, so the main code block is skipped entirely.
Fix
Change bin/try to set $0 before loading:
#!/usr/bin/env ruby
# frozen_string_literal: true
$0 = File.expand_path('../try.rb', __dir__)
load $0
To reproduce
gem install try-cli
try # No output, exits silently
try --help # No output, exits silently