Repository navigation
mruby-exit: SystemExit.new takes a status; SystemExit#success? - #7791
Conversation
SystemExit.new(3) took 3 for the message and left status nil, and SystemExit.new had no status either; only Kernel#exit set one. As in CRuby, a leading true, false or Integer is now the status (true being 0 and false 1), the message may follow, and the status is 0 without one. SystemExit#success? answers whether the status is 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X4cowTc1oGMNQfUma7zNdD
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
SystemExit.newdidn't take a status: the argument became the message, and the status was nil unlessKernel#exithad set it:As in CRuby, a leading
true,falseor Integer is now the status (trueis 0,falseis 1), the message may follow it, and without one the status is 0.SystemExit#success?answers whether the status is 0.Kernel#exitstill sets the status itself, so it is unchanged.Tested with
MRUBY_CONFIG=ci/gcc-clang rake test(KO 0, Crash 0).🤖 Generated with Claude Code
https://claude.ai/code/session_01X4cowTc1oGMNQfUma7zNdD
Summary by CodeRabbit
SystemExitnow accepts a status and optional message, withtrueandfalsemapped to statuses 0 and 1. It defaults to status 0 when given a non-status argument and reports invalid argument combinations withArgumentError.SystemExitconstructor and its status and success methods.