[PR #7360] [MERGED] Be quiet when redirecting output #12396

Closed
opened 2026-04-12 23:58:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/7360
Author: @dhiltgen
Created: 10/25/2024
Status: Merged
Merged: 11/22/2024
Merged by: @dhiltgen

Base: mainHead: quiet_redirect


📝 Commits (1)

  • 2fa42fd Be quiet when redirecting output

📊 Changes

1 file changed (+4 additions, -0 deletions)

View changed files

📝 cmd/cmd.go (+4 -0)

📄 Description

This avoids emitting the progress indicators to stderr, and the interactive prompts to the output file or pipe. Running "ollama run model > out.txt" now exits immediately, and "echo hello | ollama run model > out.txt" produces zero stderr output and a typical response in out.txt

Example output from the echo pipe scenario:

% cat out.txt
Hello! It's nice to meet you. Is there something I can help you with, or would you like to chat?

Prior to this change "ollama run model > out.txt" would generate the progress spinners, but the prompt went to the file, so you have to type blind and you can enter prompts, then have to do /bye to exit the session, and the resulting output file looks something like this:

% cat out.txt
>>> hello
Hello! It's nice to meet you. Is there something I can help you with, or would you like to chat?

>>> /bye

Fixes #6120


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/7360 **Author:** [@dhiltgen](https://github.com/dhiltgen) **Created:** 10/25/2024 **Status:** ✅ Merged **Merged:** 11/22/2024 **Merged by:** [@dhiltgen](https://github.com/dhiltgen) **Base:** `main` ← **Head:** `quiet_redirect` --- ### 📝 Commits (1) - [`2fa42fd`](https://github.com/ollama/ollama/commit/2fa42fdd56bd5493e308dd16ad8dbae0b3245f0c) Be quiet when redirecting output ### 📊 Changes **1 file changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+4 -0) </details> ### 📄 Description This avoids emitting the progress indicators to stderr, and the interactive prompts to the output file or pipe. Running "ollama run model > out.txt" now exits immediately, and "echo hello | ollama run model > out.txt" produces zero stderr output and a typical response in out.txt Example output from the echo pipe scenario: ``` % cat out.txt Hello! It's nice to meet you. Is there something I can help you with, or would you like to chat? ``` Prior to this change "ollama run model > out.txt" would generate the progress spinners, but the prompt went to the file, so you have to type blind and you can enter prompts, then have to do `/bye` to exit the session, and the resulting output file looks something like this: ``` % cat out.txt >>> hello Hello! It's nice to meet you. Is there something I can help you with, or would you like to chat? >>> /bye ``` Fixes #6120 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-12 23:58:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#12396