Issue #11969 has been updated by Alex Boyd.


Opened https://github.com/ruby/ruby/pull/1205 a few days ago. Here's the patch:

~~~
diff --git a/lib/irb.rb b/lib/irb.rb
index 45f3280..92b79b3 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -525,7 +525,7 @@ def eval_input
             print messages.join("\n"), "\n"
             unless lasts.empty?
               printf "... %d levels...\n", levels if levels > 0
-              print lasts.join("\n")
+              print lasts.join("\n"), "\n"
             end
             print "Maybe IRB bug!\n" if irb_bug
           end
~~~

This goes back at least to 1.9.3. Can we get this backported?

----------------------------------------
Bug #11969: IRB: Final newline missing in truncated backtraces
https://bugs.ruby-lang.org/issues/11969#change-56218

* Author: Stefan Daschek
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
If IRB shows a backtrace that gets truncated because of `back_trace_limit`, the last line of the backtrace does not end with a newline.

Steps to reproduce:

~~~
$ irb -f --back-trace-limit 1
irb(main):001:0> foo
~~~

Actual output:

~~~
NameError: undefined local variable or method `foo' for main:Object
Did you mean?  fork
	from (irb):1
	from /Users/stefan/.rbenv/versions/2.3.0/bin/irb:11:in `<main>'irb(main):002:0> 
~~~

Expected output:

~~~
NameError: undefined local variable or method `foo' for main:Object
Did you mean?  fork
	from (irb):1
	from /Users/stefan/.rbenv/versions/2.3.0/bin/irb:11:in `<main>'
irb(main):002:0> 
~~~

Tested with Ruby 2.3.0, but this seems to affect older versions as well. 



-- 
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>