Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitting CTRL+C while inside nanoc shell always exits abruptly #1309

Closed
gpakosz opened this issue Jan 31, 2018 · 7 comments
Closed

Hitting CTRL+C while inside nanoc shell always exits abruptly #1309

gpakosz opened this issue Jan 31, 2018 · 7 comments

Comments

@gpakosz
Copy link
Member

@gpakosz gpakosz commented Jan 31, 2018

Within nanoc shell, hitting CTRL+C quits abruptly with "stdout closed".

You need to $ reset your terminal emulator to move on.

Steps to reproduce

  1. bundle exec nanoc shell
  2. hit CTRL+C
  3. Nanoc shell exists leaving terminal seemingly unresponsive: you have to $ reset before being able to see what you're typing again

Another manifestation of the bug

  1. bundle exec nanoc shell
  2. start typing some Ruby
  3. realize you messed up and try to hit CTRL+C to cancel your typing
  4. Nanoc shell exits leaving terminal seemingly unresponsive, instead of cancelling the typing

Expected behavior

Nanoc shell cancels current typing instead of always exiting. Nanoc shell only exits when the REPL input is empty, just like irb.

In any case when Nanoc shell exits, one shouldn't have to $ reset the terminal emulator.

@ddfreyne
Copy link
Member

@ddfreyne ddfreyne commented Jan 31, 2018

Can you show me the output of bundle exec nanoc --version?

@gpakosz
Copy link
Member Author

@gpakosz gpakosz commented Jan 31, 2018

Oops sorry, it's nanoc 4.8.16

$ bundle exec nanoc --version
Nanoc 4.8.16 © 2007-2017 Denis Defreyne.
Running ruby 2.4.3 (2017-12-14) on x86_64-darwin16 with RubyGems 2.6.14.

@ddfreyne
Copy link
Member

@ddfreyne ddfreyne commented Jan 31, 2018

I can’t reproduce this problem, unfortunately!

The Nanoc, Ruby and RubyGems are recent enough, too.

It appears other people have had similar issues with Pry: see e.g. pry/pry#1275, which is a Pry issue that has been open for quite a while.

@ddfreyne
Copy link
Member

@ddfreyne ddfreyne commented Feb 7, 2018

@gpakosz Is this a problem for you with pure pry as well, or just nanoc shell?

@gpakosz
Copy link
Member Author

@gpakosz gpakosz commented Feb 7, 2018

When I launch pry, hitting CTRL+C doesn't exit pry:

image

@ddfreyne
Copy link
Member

@ddfreyne ddfreyne commented Feb 17, 2018

@gpakosz Does the problem persist when you do the following?

  1. bundle exec nanoc shell
  2. Signal.trap('SIGINT') { raise Interrupt }
  3. Press ^C

@gpakosz
Copy link
Member Author

@gpakosz gpakosz commented Feb 18, 2018

Loading site… done
[1] pry(#<Nanoc::Int::Context>)> Signal.trap('SIGINT') { raise Interrupt }
=> #<Proc:0x00007f9d6815c950@/usr/local/lib/ruby/gems/2.5.0/gems/nanoc-4.8.16/lib/nanoc/cli/error_handler.rb:39>
[2] pry(#<Nanoc::Int::Context>)>
[2] pry(#<Nanoc::Int::Context>)>

Better!

ddfreyne added a commit that referenced this issue Feb 19, 2018
Handle SIGINT in shell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants