GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Honor kill_after_timeout with output streams by pick7 · Pull Request #2189 · gitpython-developers/GitPython

Conversation

@pick7

@pick7 pick7 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Start the existing timeout watchdog when output_stream is used.
  • Keep the watchdog active until the subprocess has actually exited.
  • Add a regression test where stdout closes before the child process sleeps.

Fixes #1762.

Validation

  • .venv/bin/python -m pytest -o addopts= test/test_git.py
  • .venv/bin/python -m ruff check git/cmd.py test/test_git.py
  • .venv/bin/python -m ruff format --check git/cmd.py test/test_git.py
  • .venv/bin/python -m mypy git/cmd.py

AI agent disclosure

This pull request was prepared and submitted by OpenAI Codex acting as an AI agent through the contributor account.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pick7
fix: honor timeout with output streams
59efde9
@Byron
Byron requested a review from Copilot July 26, 2026 04:06
Copilot started reviewing on behalf of Byron July 26, 2026 04:08
View session
Copilot AI reviewed Jul 26, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Git.execute(..., kill_after_timeout=...) so timeouts are enforced even when output_stream is provided, aligning behavior with the documented intent and closing the gap described in #1762.

Changes:

  • Start and manage the existing timeout watchdog during the output_stream execution path, keeping it active until the subprocess exits.
  • Refactor timeout error construction into a helper used by both communicate() and output_stream paths.
  • Add a regression test where the child closes stdout early and then sleeps, ensuring kill_after_timeout still triggers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
git/cmd.py Starts/cancels the timeout watchdog for output_stream runs and centralizes timeout error creation.
test/test_git.py Adds a non-Windows regression test to confirm kill_after_timeout is honored with output_stream.
Comments suppressed due to low confidence (1)

git/cmd.py:1490

  • communicate() starts the watchdog timer but only cancels it on the success path. If proc.communicate() raises (e.g., due to an I/O error), the timer remains scheduled and can later kill the process (or a reused PID) after execute() has already failed. Cancel the watchdog in a finally to ensure it is always cleaned up.
            def communicate() -> Tuple[AnyStr, AnyStr]:
                assert watchdog is not None
                assert kill_check is not None
                watchdog.start()
                out, err = proc.communicate()
                watchdog.cancel()
                if kill_check.is_set():
                    err = make_timeout_error()
                return out, err

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread git/cmd.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Use g for formatting floating point timeouts
484b3df
The timeout error message formats `timeout` with `%d`, but `kill_after_timeout` is typed as `float` and is commonly passed as a non-integer (e.g., 0.1). This can produce a misleading message (truncation to 0) and may raise a formatting error depending on Python behavior. Format it as a float (or generic number) instead.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Byron
Byron approved these changes Jul 26, 2026
View reviewed changes

@Byron Byron left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks a lot, this circumstantially looks good to me.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Byron
Byron merged commit 2e5b13f into gitpython-developers:main Jul 26, 2026
48 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@Byron Byron Byron approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Git.execute output_stream is not documented to suppress kill_after_timeout, but does

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@pick7 @Byron
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.