Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If no stdout/stderr requested tell Kubernetes not to send it #213

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

jacobtomlinson
Copy link
Member

In cases where you want to write stdout from an exec to a file you may want to avoid also storing that output in the stdout attributed. Especially in cases where this will be large. This PR adds a capture_output kwarg to disable this.

Note

This behaviour is the inverse of subprocess.run() which disables capturing by default.

import kr8s, tempfile

pod = kr8s.objects.Pod.get("my-pod")

with tempfile.TemporaryFile(mode="w+b") as tmp:
    pod.exec(["date"], stdout=tmp, capture_output=False)

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8503458) 95.06% compared to head (06b3435) 95.07%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #213   +/-   ##
=======================================
  Coverage   95.06%   95.07%           
=======================================
  Files          26       26           
  Lines        2576     2580    +4     
=======================================
+ Hits         2449     2453    +4     
  Misses        127      127           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jacobtomlinson jacobtomlinson merged commit ec997ce into kr8s-org:main Nov 21, 2023
11 checks passed
@jacobtomlinson jacobtomlinson deleted the exec-capture-output branch November 21, 2023 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant