Skip to content

Commit 1ec4ef9

Browse files
committed
Suppress Interrupt exception for LSP
This PR suppresses the following backtrace of `Interrupt` exception for LSP: ## Before ```console $ bundle exec rubocop --lsp ^C/Users/koic/.rbenv/versions/3.4-dev/lib/ruby/gems/3.4.0+0/gems/language_server-protocol-3.17.0.3/ lib/language_server/protocol/transport/io/reader.rb:16:in 'IO#gets': Interrupt from /Users/koic/.rbenv/versions/3.4-dev/lib/ruby/gems/3.4.0+0/gems/language_server-protocol-3.17.0.3/ lib/language_server/protocol/transport/io/reader.rb:16:in 'LanguageServer::Protocol::Transport::Io::Reader#read' from /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/lsp/server.rb:35:in 'RuboCop::LSP::Server#start' (snip) ``` ## After ```console $ bundle exec rubocop --lsp ^C Exiting... ```
1 parent 49c6e92 commit 1ec4ef9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/rubocop/cli.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ def run(args = ARGV)
5757
rescue RuboCop::Error => e
5858
warn Rainbow("Error: #{e.message}").red
5959
STATUS_ERROR
60+
rescue Interrupt
61+
warn ''
62+
warn 'Exiting...'
63+
STATUS_INTERRUPTED
6064
rescue Finished
6165
STATUS_SUCCESS
6266
rescue OptionParser::InvalidOption => e

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy