[#105450] [Ruby master Feature#18228] Add a `timeout` option to `IO.copy_stream` — "byroot (Jean Boussier)" <noreply@...>
Issue #18228 has been reported by byroot (Jean Boussier).
11 messages
2021/09/27
[ruby-core:105485] [Ruby master Bug#18170] Exception#inspect should not include newlines
From:
"ioquatix (Samuel Williams)" <noreply@...>
Date:
2021-09-29 09:47:48 UTC
List:
ruby-core #105485
Issue #18170 has been updated by ioquatix (Samuel Williams).
I asked Jon Rowe from RSpec to check this. He monkey patched (3) into rspec and:
> I monkey patched an equivalent fix into my local code, and nothing failed, so I’m 80% confident we don’t even match on inspect outputs in our specs
Followed by:
> rspec isn’t broken by this but please don’t escape \n in message
Which is okay since we aren't proposing any changes to `Exception#message`, only `#inspect`.
I can also follow up with minitest authors if that's helpful.
----------------------------------------
Bug #18170: Exception#inspect should not include newlines
https://bugs.ruby-lang.org/issues/18170#change-93934
* Author: mame (Yusuke Endoh)
* Status: Assigned
* Priority: Normal
* Assignee: mame (Yusuke Endoh)
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Is this intentional?
```
p StandardError.new("foo\nbar")
#=>
# #<StandardError: foo
# bar>
```
I expect `#inspect` returns a one-line string. How about returning `#<StandardError: "foo\nbar">` or something?
Recently, multi-line error messages have been increasing by the introduction of did_you_mean and error_highlight. Printing an object that contains such an exception leads to a tricky output:
```
class Foo
def initialize
@exception = begin; exampl; rescue Exception; $!; end
end
def example
end
end
p Foo.new
#=>
# #<Foo:0x00007f15aeb4ba48 @exception=#<NameError: undefined local variable or method `exampl' for #<Foo:0x00007f15aeb4ba48 ...>
#
# @exception = begin; exampl; rescue Exception; $!; end
# ^^^^^^
# Did you mean? example>>
```
This issue was originally found by @ioquatix
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>