mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #20160 from Homebrew/mcp_server_eof
mcp_server: fix EOF handling.
This commit is contained in:
commit
2c16fe9184
@ -155,6 +155,8 @@ module Homebrew
|
||||
input = if ping_switch?
|
||||
{ jsonrpc: JSON_RPC_VERSION, id: 1, method: "ping" }.to_json
|
||||
else
|
||||
break if @stdin.eof?
|
||||
|
||||
@stdin.gets
|
||||
end
|
||||
next if input.nil? || input.strip.empty?
|
||||
|
@ -228,6 +228,8 @@ RSpec.describe Homebrew::McpServer do
|
||||
end
|
||||
|
||||
it "exits on Interrupt" do
|
||||
stdin.puts
|
||||
stdin.rewind
|
||||
allow(stdin).to receive(:gets).and_raise(Interrupt)
|
||||
expect do
|
||||
server.run
|
||||
@ -237,6 +239,8 @@ RSpec.describe Homebrew::McpServer do
|
||||
end
|
||||
|
||||
it "exits on error" do
|
||||
stdin.puts
|
||||
stdin.rewind
|
||||
allow(stdin).to receive(:gets).and_raise(StandardError, "fail")
|
||||
expect do
|
||||
server.run
|
||||
|
Loading…
x
Reference in New Issue
Block a user