Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

close input channel when receiving `io.EOF`

Jeffrey Morgan2d75a4537c6e
diff --git a/cmd/cmd.go b/cmd/cmd.go
index b05c5bae0..968d049b6 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -536,7 +536,6 @@ func generateInteractive(cmd *cobra.Command, model string) error {
if err != nil {
return err
}
- defer scanner.Close()
var wordWrap bool
termType := os.Getenv("TERM")
diff --git a/readline/readline.go b/readline/readline.go
index 95b0ca182..4a945bd5a 100644
--- a/readline/readline.go
+++ b/readline/readline.go
@@ -211,10 +211,6 @@ func (i *Instance) Readline() (string, error) {
}
}
-func (i *Instance) Close() {
- i.Terminal.Close()
-}
-
func (i *Instance) HistoryEnable() {
i.History.Enabled = true
}
@@ -239,6 +235,7 @@ func (t *Terminal) ioloop() {
for {
r, _, err := buf.ReadRune()
if err != nil {
+ close(t.outchan)
break
}
t.outchan <- r
@@ -253,7 +250,3 @@ func (t *Terminal) Read() (rune, error) {
return r, nil
}
-
-func (t *Terminal) Close() {
- close(t.outchan)
-}