From: "nobu (Nobuyoshi Nakada) via ruby-core" <ruby-core@...>
Date: 2023-04-05T01:43:38+00:00
Subject: [ruby-core:113120] [Ruby master Bug#19578] abort() shows stack trace when run within rescue clause

Issue #19578 has been updated by nobu (Nobuyoshi Nakada).


Note that broken pipe on STDOUT error message will be shown since ruby 3.0. #14413

----------------------------------------
Bug #19578: abort() shows stack trace when run within rescue clause
https://bugs.ruby-lang.org/issues/19578#change-102655

* Author: Dan0042 (Daniel DeLorme)
* Status: Rejected
* Priority: Normal
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I sometimes use the pattern `print(str) rescue abort` in order to exit without stack trace when the output of a ruby program is interrupted by SIGPIPE, ex: `./printstuff.rb | head`

It seems that since ruby 2.7 this results in printing the stack trace. This is not the case when using `abort` by itself.

Is this intended? I would expect `abort` to behave much like `exit(1)`, as it always has.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/