Commit 9ec16f0f authored by Jeffrey Morgan's avatar Jeffrey Morgan
Browse files

fix formatting when exiting `ollama run`

parent 57a58db1
...@@ -561,6 +561,7 @@ func generateInteractive(cmd *cobra.Command, model string) error { ...@@ -561,6 +561,7 @@ func generateInteractive(cmd *cobra.Command, model string) error {
line, err := scanner.Readline() line, err := scanner.Readline()
switch { switch {
case errors.Is(err, io.EOF): case errors.Is(err, io.EOF):
fmt.Println()
return nil return nil
case errors.Is(err, readline.ErrInterrupt): case errors.Is(err, readline.ErrInterrupt):
if line == "" { if line == "" {
......
...@@ -76,14 +76,15 @@ func (i *Instance) Readline() (string, error) { ...@@ -76,14 +76,15 @@ func (i *Instance) Readline() (string, error) {
} }
r, err := i.Terminal.Read() r, err := i.Terminal.Read()
if err != nil {
return "", io.EOF
}
if buf.IsEmpty() { if buf.IsEmpty() {
fmt.Print(ClearToEOL) fmt.Print(ClearToEOL)
} }
if err != nil {
return "", io.EOF
}
if escex { if escex {
escex = false escex = false
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment