Skip to content

Commit

Permalink
run_before_script: Remove reliance on console_to_str()
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Feb 2, 2025
1 parent 1cae6d4 commit c933e36
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/tmuxp/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import sys
import typing as t

from libtmux._compat import console_to_str

from . import exc

if t.TYPE_CHECKING:
Expand All @@ -37,16 +35,17 @@ def run_before_script(
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
cwd=cwd,
text=True,
)
if proc.stdout is not None:
for line in iter(proc.stdout.readline, b""):
sys.stdout.write(console_to_str(line))
sys.stdout.write(line)
proc.wait()

if proc.returncode and proc.stderr is not None:
stderr = proc.stderr.read()
proc.stderr.close()
stderr_strlist = console_to_str(stderr).split("\n")
stderr_strlist = stderr.split("\n")
stderr_str = "\n".join(list(filter(None, stderr_strlist))) # filter empty

raise exc.BeforeLoadScriptError(
Expand Down

0 comments on commit c933e36

Please sign in to comment.