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>intmain(){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.
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.