[ruby-core:113112] [Ruby master Bug#19578] abort() shows stack trace when run within rescue clause

Issue #19578 has been reported by Dan0042 (Daniel DeLorme). ---------------------------------------- Bug #19578: abort() shows stack trace when run within rescue clause https://bugs.ruby-lang.org/issues/19578 * Author: Dan0042 (Daniel DeLorme) * Status: Open * 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/

Issue #19578 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Rejected This was a deliberate change, see #16424. ---------------------------------------- Bug #19578: abort() shows stack trace when run within rescue clause https://bugs.ruby-lang.org/issues/19578#change-102647 * 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/

Issue #19578 has been updated by Dan0042 (Daniel DeLorme). Thank you, I searched but wasn't able to find it. But in that case I think the documentation should be updated. This: Terminate execution immediately, effectively by calling Kernel.exit(false). If msg is given, it is written to STDERR prior to terminating. read to me like nothing is written to STDERR if msg is not given. Perhaps update to something like: Terminate execution immediately, effectively by calling Kernel.exit(false). If msg is given, it is written to STDERR prior to terminating. Otherwise, if an exception was raised, print its message. ---------------------------------------- Bug #19578: abort() shows stack trace when run within rescue clause https://bugs.ruby-lang.org/issues/19578#change-102653 * 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/

Issue #19578 has been updated by jeremyevans0 (Jeremy Evans). Dan0042 (Daniel DeLorme) wrote in #note-2:
But in that case I think the documentation should be updated.
I agree. Can you please submit a pull request for it? ---------------------------------------- Bug #19578: abort() shows stack trace when run within rescue clause https://bugs.ruby-lang.org/issues/19578#change-102654 * 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/

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/

Issue #19578 has been updated by Dan0042 (Daniel DeLorme). jeremyevans0 (Jeremy Evans) wrote in #note-3:
I agree. Can you please submit a pull request for it?
Will do. nobu (Nobuyoshi Nakada) wrote in #note-4:
Note that broken pipe on STDOUT error message will be shown since ruby 3.0. #14413
That's a great change! I can't believe I missed it. ---------------------------------------- Bug #19578: abort() shows stack trace when run within rescue clause https://bugs.ruby-lang.org/issues/19578#change-102657 * 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/

Issue #19578 has been updated by nobu (Nobuyoshi Nakada). Of course, I missed the word "not", sorry. ---------------------------------------- Bug #19578: abort() shows stack trace when run within rescue clause https://bugs.ruby-lang.org/issues/19578#change-102658 * 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/

Issue #19578 has been updated by Dan0042 (Daniel DeLorme). jeremyevans0 (Jeremy Evans) wrote in #note-3:
I agree. Can you please submit a pull request for it?
Done: https://github.com/ruby/ruby/pull/7664 ---------------------------------------- Bug #19578: abort() shows stack trace when run within rescue clause https://bugs.ruby-lang.org/issues/19578#change-102663 * 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/
participants (3)
-
Dan0042 (Daniel DeLorme)
-
jeremyevans0 (Jeremy Evans)
-
nobu (Nobuyoshi Nakada)