From 6a83b1c263cc482d5e34edcb6c08a840a9b657c1 Mon Sep 17 00:00:00 2001 From: Caleb Denio Date: Thu, 10 Sep 2026 11:43:37 -0500 Subject: [PATCH] fix 100% cpu usage --- Makefile | 4 ++-- ssh/main.go | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e38c5ac..5896c91 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -all: bin/crossword bin/ssh +all: bin/crossword bin/crossword-ssh bin/crossword: main.go puz/puz.go game/game.go go build -o $@ . -bin/ssh: ssh/main.go puz/puz.go game/game.go +bin/crossword-ssh: ssh/main.go puz/puz.go game/game.go go build -o $@ ./ssh diff --git a/ssh/main.go b/ssh/main.go index 7d114c2..6cedf24 100644 --- a/ssh/main.go +++ b/ssh/main.go @@ -56,7 +56,10 @@ func main() { }) for { - scanner.Scan() + ok := scanner.Scan() + if !ok { + break + } buffer := scanner.Bytes() exited := state.HandleInput(buffer)