Skip to content

Fix dancing-ruby Ctrl+C stop - #735

Merged
st0012 merged 1 commit into
ruby:masterfrom
tompng:dancing_easter_egg_stop_bugfix
Oct 21, 2023
Merged

st0012 merged 1 commit into
ruby:masterfrom
tompng:dancing_easter_egg_stop_bugfix

Conversation

@tompng

@tompng tompng commented Oct 21, 2023 •

Copy link
Copy Markdown
Member

IRB has an easter egg

$ irb --noautocomplete
irb(main):001> RubyVM[PRESS TAB KEY]
easter egg ([:logo and :dancing] two patterns randomly)

Since reline 0.3.3, dancing ruby easter egg does not stop with CTRL+C because STDOUT is raw mode. I added STDOUT.cooked do end
(I think it's from ruby/reline#474, reline stopped changing raw-mode and cooked mode frequently while rendering)

Stopping dancing-ruby with CTRL+C will abort input to IRB.

if true
  RubyVM[PRESS TAB KEY] [CTRL+C] # The input `if true\n  RUBYVM` is cleared

To avoid it, I also added trap("SIGINT")

@tompng
tompng marked this pull request as draft October 21, 2023 04:01
@tompng
tompng force-pushed the dancing_easter_egg_stop_bugfix branch from 7f7dedb to fada641 Compare October 21, 2023 04:03
@tompng
tompng marked this pull request as ready for review October 21, 2023 04:03
@tompng
tompng force-pushed the dancing_easter_egg_stop_bugfix branch from fada641 to 2a47bb6 Compare October 21, 2023 04:20

@st0012 st0012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@st0012 st0012 added the bug Something isn't working label Oct 21, 2023
@st0012
st0012 merged commit 802b1cb into ruby:master Oct 21, 2023
@tompng
tompng deleted the dancing_easter_egg_stop_bugfix branch October 21, 2023 12:58
matzbot pushed a commit to ruby/ruby that referenced this pull request Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants