Skip to content

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

Open
i098 wants to merge 1 commit into
apple:mainfrom
i098:fix/container-logs-2374
Open

i098 wants to merge 1 commit into
apple:mainfrom
i098:fix/container-logs-2374

Conversation

@i098

@i098 i098 commented Oct 11, 2026

Copy link
Copy Markdown

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

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

1 participant