Skip to content

Commit

Permalink
Prevent broken pipes leading to client errors (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock authored Jul 9, 2024
1 parent ee0cec6 commit 79616bc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ruby_lsp/ruby_lsp_rails/runner_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ def send_message(request, params = nil)
json = message.to_json

@stdin.write("Content-Length: #{json.length}\r\n\r\n", json)
rescue Errno::EPIPE
# The server connection died
end

alias_method :send_notification, :send_message
Expand All @@ -193,6 +195,9 @@ def read_response
end

response.fetch(:result)
rescue Errno::EPIPE
# The server connection died
nil
end
end

Expand Down

0 comments on commit 79616bc

Please sign in to comment.