Project

General

Profile

Actions

Bug #13270

closed

IRB hangs when printing "\e]"

Added by domaio (Dorian M) about 7 years ago. Updated about 7 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
[ruby-core:79878]

Description

Steps to reproduce:

  • irb
  • print "\e]"
  • Or: puts "\e["
  • try CMD+C, nothing happens
  • try CMD+D, prints "30m"

Expected behavior:

  • just prints "30m" (that's what pry does)

Ruby versions tried:

  • ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
  • ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]

Updated by shevegen (Robert A. Heiler) about 7 years ago

Is this darwin-specific? It appears to work fine on my linux system here.

ruby 2.4.0p0 (2016-12-24 revision 57164) [i686-linux]

Updated by nobu (Nobuyoshi Nakada) about 7 years ago

  • Status changed from Open to Feedback

I can't reproduce it on darwin15.

Does it happen without irb, just ruby -e print "\e]"?
If only with irb, does it with irb -f?

Updated by snood1205 (Eli Sadoff) about 7 years ago

  • Status changed from Feedback to Open

I can reproduce it on Darwin, so I'm switching it back to open.

My ruby -v is ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin14]

Also it occurs with irb -f but not with ruby -e

Updated by snood1205 (Eli Sadoff) about 7 years ago

Even more information, this is reproducible on ruby -v ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux], but instead of printing out "30m" after CMD+D it prints out nothing. This seems to be a bug within IRB. Interesting, this behavior seems to be OS defined as well. The following program in C

#include <stdio.h>

int main()
{
        puts("\e]");
}

has different outputs based on the OS. On macOS Sierra, it outputs 30m with gcc, cc, and clang, whereas on Fedora 22 it outputs nothing with both gcc and cc. I can't exactly figure out what is wrong, but it is quite odd.

Updated by nobu (Nobuyoshi Nakada) about 7 years ago

  • Status changed from Open to Feedback

What terminal emulator are you using, the standard Terminal.app?

Updated by domaio (Dorian M) about 7 years ago

Nobuyoshi Nakada wrote:

What terminal emulator are you using, the standard Terminal.app?

I'm using iTerm 3.0.14.

And on Terminal.app (v2.7.1 (387)) I get

>> puts "\e]"

il
>> puts "\e["

nil

(notice the first "n" missing)

Also, why pry (0.10.4), on iTerm:

> puts "\e["

nil
> puts "\e]"
1;36mnil
>

I'm on MacOS Sierra 10.12.1 (16B2555)

Updated by znz (Kazuhiro NISHIYAMA) about 7 years ago

I can reproduce print "\e]" and Ctrl+C, nothing happens. But I can't reproduce using puts "\e[". And I can't reproduce Ctrl+D prints "30m". Ctrl+D causes simply exited.

I think iTerm eats output from "\e]" (OSC) to "\a" (BEL) (or "\e" or something else).

pry outputs some "\e"s after evaluation, then it seems to be without hang.

I typed print "\e]", Enter, Ctrl+C, puts "\a" (can't see), Enter. Then it outputs => nil and prompt.

% rbenv exec irb -r irb/completion --simple-prompt
>> print "\e]"

=> nil
>>

Updated by nobu (Nobuyoshi Nakada) about 7 years ago

  • Status changed from Feedback to Rejected

It is not ruby specific, and (probably) expected behavior of some terminal emulators.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0