Skip to content

Commit

Permalink
fix ansi color reset bug (#2970)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelovilla authored Mar 4, 2025
2 parents 0652d36 + 3ff1a64 commit d92b1c1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/_nebari/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def process_streams(

outputs = {"stdout": [], "stderr": []}
partial = {"stdout": b"", "stderr": b""}
reset_code = b"\x1b[0m" # ANSI reset code

try:
while True:
Expand Down Expand Up @@ -109,6 +110,15 @@ def process_streams(
sys.stderr.flush()
else:
outputs["stderr"].append(line_w_newline)

# Add reset code when we're done processing output
if print_stdout:
sys.stdout.buffer.write(reset_code)
sys.stdout.flush()
if print_stderr:
sys.stderr.buffer.write(reset_code)
sys.stderr.flush()

finally:
sel.close()
if process.stdout:
Expand Down

0 comments on commit d92b1c1

Please sign in to comment.