Skip to content

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

fix formatting when exiting `ollama run`

Jeffrey Morgan9ec16f0f0377
diff --git a/cmd/cmd.go b/cmd/cmd.go
index 968d049b6..b0f9681cd 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -561,6 +561,7 @@ func generateInteractive(cmd *cobra.Command, model string) error {
line, err := scanner.Readline()
switch {
case errors.Is(err, io.EOF):
+ fmt.Println()
return nil
case errors.Is(err, readline.ErrInterrupt):
if line == "" {
diff --git a/readline/readline.go b/readline/readline.go
index 4a945bd5a..d1fe2c8d0 100644
--- a/readline/readline.go
+++ b/readline/readline.go
@@ -76,14 +76,15 @@ func (i *Instance) Readline() (string, error) {
}
r, err := i.Terminal.Read()
- if err != nil {
- return "", io.EOF
- }
if buf.IsEmpty() {
fmt.Print(ClearToEOL)
}
+ if err != nil {
+ return "", io.EOF
+ }
+
if escex {
escex = false