Skip to content

Fix container log following when the log is empty - #2377

Merged
jglogan merged 1 commit into
apple:mainfrom
i098:fix/container-logs-2374
Oct 15, 2026
Merged

jglogan merged 1 commit into
apple:mainfrom
i098:fix/container-logs-2374

Conversation

@i098

@i098 i098 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

container logs -f exits when its initial read finds an empty log.
Skip the empty initial read without returning, so follow mode can wait for new output.
Keep the full-file read to preserve existing output before following.
Add a regression test for output appended to an initially empty log.

Leave container machine logs unchanged because it has a separate implementation and this issue concerns container logs.

Closes #2374.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Repro command, with an initially empty container log:

container logs -f logempty

Verified at the file-tail level on macOS: before the fix, it returns immediately; after, it waits and prints hello when appended.
ContainerLogsTests.followsInitiallyEmptyLog fails before the fix and passes after it.

I am new to open source, and this pull request was made with AI assistance.

@github-actions github-actions Bot added documentation Improvements or additions to documentation cli labels Oct 15, 2026
@github-actions

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 21.04%
Integration 66.74%
Combined 76.47%

@jglogan jglogan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@i098 Approved, thank you for the fix!

@jglogan
jglogan merged commit 1a9d535 into apple:main Oct 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: container logs -f exits immediately with no output when the container's log file is empty

2 participants