[前][次][番号順一覧][スレッド一覧]

ruby-changes:72649

From: Nobuyoshi <ko1@a...>
Date: Fri, 22 Jul 2022 21:01:48 +0900 (JST)
Subject: [ruby-changes:72649] a4e890b93e (master): [rubygems/rubygems] Use `SystemExit#status` as `exit_code`

https://git.ruby-lang.org/ruby.git/commit/?id=a4e890b93e

From a4e890b93e826b923175f4eb9b05823e82fb1fb1 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 22 Jul 2022 12:27:21 +0900
Subject: [rubygems/rubygems] Use `SystemExit#status` as `exit_code`

No reasons to manage separately.

https://github.com/rubygems/rubygems/commit/8ede5c886e
---
 lib/rubygems/exceptions.rb | 4 +---
 test/rubygems/test_exit.rb | 6 ++++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb
index 5fadbe9bca..48964b10d9 100644
--- a/lib/rubygems/exceptions.rb
+++ b/lib/rubygems/exceptions.rb
@@ -221,14 +221,12 @@ class Gem::SystemExitException < SystemExit https://github.com/ruby/ruby/blob/trunk/lib/rubygems/exceptions.rb#L221
   ##
   # The exit code for the process
 
-  attr_accessor :exit_code
+  alias exit_code status
 
   ##
   # Creates a new SystemExitException with the given +exit_code+
 
   def initialize(exit_code)
-    @exit_code = exit_code
-
     super exit_code, "Exiting RubyGems with exit_code #{exit_code}"
   end
 end
diff --git a/test/rubygems/test_exit.rb b/test/rubygems/test_exit.rb
index 3986daa992..707150efaa 100644
--- a/test/rubygems/test_exit.rb
+++ b/test/rubygems/test_exit.rb
@@ -8,4 +8,10 @@ class TestExit < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_exit.rb#L8
     system(*ruby_with_rubygems_in_load_path, "-e", "raise Gem::SystemExitException.new(2)")
     assert_equal 2, $?.exitstatus
   end
+
+  def test_status
+    exc = Gem::SystemExitException.new(42)
+    assert_equal 42, exc.status
+    assert_equal 42, exc.exit_code
+  end
 end
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]